日期:2014-05-16 浏览次数:20526 次
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="Scripts/jquery-1.9.1.min.js"></script>
</head>
<body>
<table>
<tr>
<td>
<p id="pclick">点我给页面添加一个按钮</p>
</td>
</tr>
</table>
<script>
$(function () {
$("#pclick").on("click", function () {
$("<input type='button' value='test' id='btnTest' />").insertAfter($(this));
});
$("#btnTest").on("click", function () {
alert("进来了");
});
})
</script>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>