我有一个文本框,用户在其中输入一个介于1到10之间的数字。根据在文本框中输入的数字,这些文本框必须动态生成(我的意思是不按任何按钮)。有人能帮我做这件事吗?
发布于 2011-07-16 20:18:36
<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>演示:http://sandbox.phpcode.eu/g/d6046.php
发布于 2011-07-16 21:00:17
document.getElementById("YourId").onchange = function(){
alert("The text in the textbox has changed");
}https://stackoverflow.com/questions/6717277
复制相似问题