Jquery使用
1248 ワード
<html>
<head>
<script type="text/javascript" src="jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#add").click(function(){
$("#main").append('<input type="text" value="" name="a2" class="a2" />');
});
$(document).on("change",".a2",function(e){
alert($(this).val());
});
});
</script>
</head>
<body>
<div id="main" style="width:300px; height:100px;border:1px solid red">
</div>
<input type="button" value=" " id="add" />
</body>
</html>