javascript - How can I get the value from a series of textbox with same id -
i have series of textboxes same name
<%for(i=0;i<=nooftasks;i++){%> <input type="text" id="duration" name="duration" class="td4" onkeyup="durationformat()"> }%>
in javascript have add colon after 2 digits
function durationformat() { var duration = document.getelementsbyname("duration").value; if(duration.length==2){ duration=duration+":"; } }
but not desired result not string textbox
of particular text box.
any ideas?
<input type="text" id="duration" name="duration" class="td4" onkeyup="durationformat(this)"> <script> function durationformat(obj) { if ((obj.value.length)== 2) { obj.value+=":"; } } </script>
Comments
Post a Comment