Saturday, June 6, 2020

jquery dropdown no of text box

<script>

 function getslab(val)

 {


  

            //var value = $(this).val();

     alert(val);

    var container = document.getElementById('container'); //Cache container.

var i;

container.innerHTML="";


    for(var i = 1; i <= val; i++){

        var tb = document.createElement('input');

  var lab = document.createElement('label');

  lab.type = 'label';

        lab.id = 'label_' + i;

  lab.innerHTML= 'label_' + i;

        tb.type = 'text';

        tb.id = 'textBox_' + i; // Set id based on "i" value

  container.appendChild(lab); 

       container.appendChild(tb); 

    }

 return false;

 }

</script>

No comments:

Post a Comment