I have a textbox in which user enters a number between 1 to 10. Based on the number entered in the textbox those m开发者_如何学Pythonany textboxes have to be generated dynamically (i mean without pressing any button). Can anyone help me out in doing this??
<input id="input" />
<div id="space"></div>
<script>
$("#input").keyup(function(){
var $count = $(this).val();
$("#space").html('');
for ($i=0;$i<$count;$i++)
{
$("#space").append('<input name="'+$count+'_input" />');
}
});
</script>
demo: http://sandbox.phpcode.eu/g/d6046.php
element.onchange
document.getElementById("YourId").onchange = function(){
alert("The text in the textbox has changed");
}
精彩评论