创建了一个节点,为什么点击添加却没添加成功?代码如下:
-------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0022)http://localhost:1634/ -->
<html>
<head>
<title>学习经历维护</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<link
rel="stylesheet" type="text/css" href="css/default.css">
<link
rel="stylesheet" type="text/css" href="css/style.css">
<meta name="GENERATOR" content="MSHTML 8.00.7600.16385">
<style type="text/css">
td {
background-color: #fff;
} th {
background-color: #dddddd;
text-align: left;
width: 33%;
}
</style>
<script src="js/jquery-1.8.3.js"></script>
<script>
//添加节点
$(function () {
var $input = $('<tr><td><input type="text"/></td><td><input type="text"/></td><td><input type="text"/></td>'); $('table').append($input);
$('#add').click(function () {
$('table').append($input);
});
});
</script></head>
<body>
<div class="Edu_InfoTD">
<form method="post"action="#" id="expForm">
<table border="0" cellspacing="1" cellpadding="3" width="600px" bgcolor="#cccccc">
<tr>
<th>学校 </th>
<th>开始时间 </th>
<th>结束时间 </th>
</tr>
</table>
<div><a href="#" id="add">添加一条</a></div>
<p>
<input value="全部提交" type="submit">
</p>
</form>
</div>
</body>
</html>
-------------------------------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0022)http://localhost:1634/ -->
<html>
<head>
<title>学习经历维护</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<link
rel="stylesheet" type="text/css" href="css/default.css">
<link
rel="stylesheet" type="text/css" href="css/style.css">
<meta name="GENERATOR" content="MSHTML 8.00.7600.16385">
<style type="text/css">
td {
background-color: #fff;
} th {
background-color: #dddddd;
text-align: left;
width: 33%;
}
</style>
<script src="js/jquery-1.8.3.js"></script>
<script>
//添加节点
$(function () {
var $input = $('<tr><td><input type="text"/></td><td><input type="text"/></td><td><input type="text"/></td>'); $('table').append($input);
$('#add').click(function () {
$('table').append($input);
});
});
</script></head>
<body>
<div class="Edu_InfoTD">
<form method="post"action="#" id="expForm">
<table border="0" cellspacing="1" cellpadding="3" width="600px" bgcolor="#cccccc">
<tr>
<th>学校 </th>
<th>开始时间 </th>
<th>结束时间 </th>
</tr>
</table>
<div><a href="#" id="add">添加一条</a></div>
<p>
<input value="全部提交" type="submit">
</p>
</form>
</div>
</body>
</html>
解决方案 »
- 希望大家都讨论下 一个隐藏比较深的问题,事件传播
- javascript:setTimeout()和setinterval()函数是什么?
- 在myeclipse中编写extJs。。。。。myeclipse很卡。。。怎么办啊?
- 请教一下我用\u4e00-\u9fa5验证中文,但是拼音字母可以通过?请问怎么解决?
- 使用java scirpt 进行页面跳时,总是打开原有的页面,有没有什么方法可以让它打开时就是一个新页面?
- 两数相减的Js脚本判断
- 玩过 domino 的兄弟请进来!
- 请教一个若若的问题
- ajax 请求响应头信息
- 关于ECharts3引用地图的问题
- js中.style为什么只能获取到内联样式值?和浏览器渲染过程有关吗?
- easyui datagrid 中已经可以将数据全部显示出来,现在要在页面中根据比如姓名查询,在不用重新加载数据库的前提下,怎么在datagrid中实现
====>改为字符,要不是jquery对象,里面的dom只能出现在dom树种的一个地方,所以你在append就是添加同一个对象
var $input = '<tr><td><input type="text"/></td><td><input type="text"/></td><td><input type="text"/></td></tr>';Web开发学习资料推荐
jQuery仿excel表格单元格合并插件
jquery全年日期选择器日历插件