开发者

jQuery: Get Child object with specific ID

开发者 https://www.devze.com 2023-01-19 11:51 出处:网络
First some HTML: <div id=\"tmcl-request\" class=\"tmcl-request\" style=\"display: none\"> Request:

First some HTML:

<div id="tmcl-request" class="tmcl-request" style="display: none">
Request:
<b> Node: </b><span id="node">33947</span>
</div>

Than some JavaScript:

$request = $('#tmcl-request');
$newrequest = $request.clone();

And now the question: I want to change the inner HTML of the <span id="node"> from the $newrequest object.

How to do this?开发者_如何学编程

Thanks, Bigbohne


$('#tmcl-request').find('#node').html('whatever you want your html to be');

Thought, if you will have multiple nodes it's better to use a class instead of an id, so

$newrequest.find('#node').html('your html');
0

精彩评论

暂无评论...
验证码 换一张
取 消