我正在解决我的css的一个问题。我有以下div标签:
<div class="span1" id="progress-indicator" style="text-align:left; border:2px solid #000;"> </div>在代码的脚本部分的后面,我做了类似这样的事情:
$('#progress-indicator').html("saving changes....");使用html()方法时,它是只更改开始/结束div标签之间的空格,还是更改div标签的属性?我之所以这样问,是因为一旦调用了这个jquery,div的大小似乎就超过了span1 div应有的大小。
谢谢。
发布于 2013-03-26 09:56:40
jQuery文档只提到内容受影响:http://api.jquery.com/html/
我引用:"Description:设置匹配元素集中每个元素的HTML内容。“
jquery文档的一个示例:
$('div.demo-container')
.html('<p>All new content. <em>You bet!</em></p>');这行代码将替换其中的所有内容:
<div class="demo-container">
<p>All new content. <em>You bet!</em></p>
</div>我举了一个例子:http://jsfiddle.net/caZtd/
现在,如果您单击进度指示器div,并在单击之前和之后检查元素(使用chrome开发工具的firefox中的firebug ),您将看到html标记没有任何区别。
https://stackoverflow.com/questions/15623982
复制相似问题