Hi!
Sorry for my bad english.
I need help. I have a code (it's long so here's short version) that will, when I click on the button 1 (input field 1 and button 1), make a new input field and button with new name (input field2 and button 2) and in the input field 1 will write "broj1" (en. number1). Then, when I click on the button 2, in the input field 2 will write "broj2" (en. number2). That's all OK. The problem is, when I click on the button 2 (in the field 1 write "broj 1"), text in the input field 1 dissapears. What's wrong with my code.
Here's it:
<script type="text/javascript">
i=1;
x=0;
function zabiljezi(){
i=(i*1)+(1*1);
x=(x*1)+(1*1);
id="zabiljezi"+x;
document.getElementById('sve').innerHTML+=i+". <input type=\"text\" id=\"zabiljezi"+i+"\"> <input type=\"button\" value=\"Zabiljezi\" onclick=\"zabiljezi()\"><br>";
document.getElementById(id).value="broj"+x;
}
</script>
<div id="sve">
1. <input type="text" id="zabiljezi1">
<input type="button" value="Zabiljezi" onclick="zabiljezi();"><br>
</div>
Thank you all for your help.
PS: I hope you understand me.