+ 3
Input with button
I have a two <input Type="text"> <input type ="text "> when I will write text and click my <button >ok</button > I want to text add my div when have a display none and will show div when I will click OK button
36 Réponses
+ 9
1 year maybe
started using it more once i joined sololearn
+ 8
ty
js is a really fun language and seems it is only on the rise
and good luck to you on your future endeavours
+ 7
https://code.sololearn.com/WC8pUiTrUlbY/?ref=app
something like this?
+ 7
i made changes already to the code you supplied in jfiddle and it works with numbering for me.
i am having hard time understanding what is the issue you are having with the ul/ol
+ 6
ol is ordered list
with order being the numbers
ul is unordered list so each item is marked with •
just go with ol xD
+ 6
ohh..... mind uploading the code here on the playground?
+ 5
re-check my code
@Calvin no problem
the more the merrier xD
+ 5
xD
+ 5
added a button inside each li
the onclick handler is the function removeEl which assign the parentElement to the element which was sent as a parameter and then thru its parent remove the entire li element
+ 4
i suggest you make a code in the playground and link to it
it would help us to help you better
also we could work on existing code and see the problem more easily
+ 4
change to ol for numbering
there is already a <ol> inside the div
i just add list items <li>input1 input2</li> into it
but with ol you will get for inputs
1
test
2
test
the following:
1.1 test
2.2 test
so the input for number is not needed as ol adds this for each item added
+ 3
1 text
2 text
.......
represent each input?
like if first input is 1, text and the second is 2, text and so on
so each time you click the button it is added to the list?
+ 3
thx so much u today help me understand my homework 🤘👏
+ 2
function g(){
var c=document.getElementById('demo1');
c.style.display="block";
var inp=document.getElementsByTagName('input');
document.getElementById('demo1').innerHTML = document.getElementById('inp').value;
}
+ 2
ok I will do it
+ 2
updated code
added
inp[i].value="";
this will clear the fields
and i used for loop because, what if you added more onput fields in the future?
no need to modify anything else
or if you remove an input field
+ 2
ok sorry don't see html thx so much 👍👍🤗
+ 2
u know now I'm thinking how I can after delete my each list line I'm thinking do it remove.childe I'm right
+ 2
good but I don't understand u can explain me