Javascript auto generate unique id for textbox -
in javascript got problem in create unique auto generate id in textbox. textbox must readonly. please help. id should pt1
<tr> <td>patient admissionid:</td> <td><input type="text" readonl placeholder="patient id"/></td> </tr>
<div class="input-container"> <input type="text" id="pt1"> </div> <button id="addinput">add input</button>$('#addinput').on('click',function(){ var inputcount = $(".input-container").find($("input")); var uniqueinput = "pt"+inputcount.length + 1; $(".input-container").append("<input type='text' id='" +uniqueinput+ "'>"); })
working fiddle https://jsfiddle.net/wx38rz5l/657/
Comments
Post a Comment