I have sample code like this
<input type="button" value="test" onclick="newfunc()"/>
<br/>
<div class="first">
<input type="text" id="iid88" />
<br />
</div>
<script>
function newfunc() {
var one = document.getElementsByClassName('first')[0].querySelectorAll("[id^=iid]");
for (var i = 0; i < one.length; i++)
{
setInterval(function () {
one[i].value = 20;
}, 1000);
}
}
</script>
i cannot get answer within input text box . how can i resolve this problem ?
i see this page JavaScript closure inside loops – simple practical example but here we dont have any setInterval usage in answers