开发者

Dynamic textbox generation

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");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜