我使用 jQuery 将内容附加到每个contentx
类中。
<div id="sidebar">
<div class="contentx"></div>
<div class="contentx"></div>
</div>
<script>
$("#sidebar .contentx").each(function()
{
//Append here
}
</script>
附加后我有,例如:
<div id="sidebar">
<div class="contentx">
something 1 is inserted here.
</div>
<div class="contentx">
something 2 is inserted here.
</div>
</div>
但我想在附加内容时删除 class="contentx" 。这意味着我只有:
<div id="sidebar">
something 1 is inserted here.
something 2 is inserted here.
</div>
如何