I'm new to javascript. I am trying to add multiple text box dynamically on run time..
<script type="text/javascript">
function ajax(){
var x = document.getElementById("ajax").innerHTML;
x= x + '<input name="reference[]" type="text" />';
document.getElementById("ajax").innerHTML = x;
}
</script>
This is an on click event. Here my problem is that every time add a new text box the value of my previous text box disappears and an all the text boxes are empty each time the function is called.