How to fill a dynamic textbox with a text from another textbox using jquery? -


here code

var rowcount = $('#tblapplidn tr').length; var index = rowcount + 1; $('#tblapplidn').append("<tr><td><input type='hidden' name='identitity.index' value='" + index + "' /><input type='text'  name='identitity[" + index + "].typeofidentification' value=" + $('#typeofidentification').val() + "></td><td><input type='text'  class='textreq' name='identitity[" + index + "].identitynumber' value=" + value + "></td><td><input type='text'  class='textreq'  name='identitity[" + index + "].issuedate' value=" + $('#issuedate').val() + "></td><td><input type='text'  class='textreq'  name='identitity[" + index + "].expirydate' value=" + $('#expirydate').val() + "></td><td><input type='text'  class='textreq'  name='identitity[" + index + "].datereceived' value=" + $('.receiveddte').val() + "></td><td><input type='text'  class='textreq'  name='identitity[" + index + "].issuingauthority' value=" + $('.issauthority').val() + "></td><td><input type='text'  name='identitity[" + index + "].placeofissue' value=" + $('#placeofissue').val() + "></td><td><input type='text'  class='textreq'  value=" + $('#countryofissue option:selected').text() + "><input type='hidden' class='textreq'   name='identitity[" + index + "].countryofissue' value=" + $('#countryofissue').val() + "></td><td><input type='button' name='remove' class='remove' value='remove' id='" + index + "'/></tr>"); 

the above code not fill dynamic textbox properly. suppose if identitynumber=aa 1234 dynamic textbox takes aa , not fill after space. tried taking variable , assigned value variable , variable when passed value still behaves same way. have around 12 tab , tab needs dynamic textboxes added upon clicking add button , user have option add multiple records. within inspect element can find

<input type="text" class="textreq valid" name="identitity[2].identitynumber" value="aa" 1234 aria-invalid="false"> 

how include entire value within dynamic textbox. browsed , tried find doesn't works. comments , answer's appreciated.

ok. might not optimal solution achieve requirement can use it!! not sure why not able append values space gonna store values in each variable , assigned each input of last trs td below:

demo

$('.btnapplidndtls').click(function () {     var rowcount = $('#tblapplidn tr').length;     var index = rowcount + 1;     var indentifytype=$('#typeofidentification option:selected').text();//get values     var identifynum=$("#identitynumber").val();//get values     var issuedate=$('#issuedate').val();//get values     $('#tblapplidn').append("<tr><td><input type='hidden' name='identitity.index' value='" + index + "' /><input type='text'  name='identitity[" + index + "].typeofidentification'></td><td><input type='text'  class='textreq' name='identitity[" + index + "].identitynumber'></td><td><input type='text'  class='textreq'  name='identitity[" + index + "].issuedate'></td><td><input type='button' name='remove' class='remove' value='remove' id='" + index + "'/></tr>");//simply append     var lasttr=$('#tblapplidn tr:last'); //get last tr     lasttr.find('td:first input[type="text"]').val(indentifytype); give input value     lasttr.find('td:nth-child(2) input').val(identifynum);     lasttr.find('td:nth-child(3) input').val(issuedate); }); 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -