首先是一些 HTML:
<div id="tmcl-request" class="tmcl-request" style="display: none">
Request:
<b> Node: </b><span id="node">33947</span>
</div>
比一些 JavaScript:
$request = $('#tmcl-request');
$newrequest = $request.clone();
现在的问题是:我想更改 <span id="node">
的内部 HTML来自$newrequest
对象。
如何做到这一点?
谢谢, 比格博恩
最佳答案
$('#tmcl-request').find('#node').html('whatever you want your html to be');
我想,如果你有多个节点,最好使用类而不是 id,所以
$newrequest.find('#node').html('your html');
关于jQuery:获取具有特定 ID 的子对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3913891/