html中<tr>标签中包含<div>标签
如下代码:<html><head><scriptsrc="jquery-1.9.1.js"></script><script>functionhi(){varappend...
如下代码:
<html>
<head>
<script src="jquery-1.9.1.js"></script>
<script>
function hi(){
var appendStr = "<tr><div>this is a text</div><td>hello</td></tr>";
$("#tab").append(appendStr);
}
</script>
</head>
<body>
<table id="tab">
<tr>
<div id="a"></div>
<td>apple</td>
</tr>
</table>
<input type="button" value="click me" onclick="hi();"/>
</body>
</html>
运行之后,<div id='a'></div>移动到了<table>上面,当点击按钮后<tr>中的<div>this is a text</div>不见了,这是为什么呢?求大神赐教!!! 展开
<html>
<head>
<script src="jquery-1.9.1.js"></script>
<script>
function hi(){
var appendStr = "<tr><div>this is a text</div><td>hello</td></tr>";
$("#tab").append(appendStr);
}
</script>
</head>
<body>
<table id="tab">
<tr>
<div id="a"></div>
<td>apple</td>
</tr>
</table>
<input type="button" value="click me" onclick="hi();"/>
</body>
</html>
运行之后,<div id='a'></div>移动到了<table>上面,当点击按钮后<tr>中的<div>this is a text</div>不见了,这是为什么呢?求大神赐教!!! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询