Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: Get Child object with specific ID

Tags:

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

like image 811
Bigbohne Avatar asked Oct 12 '10 10:10

Bigbohne


1 Answers

$('#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'); 
like image 83
EMMERICH Avatar answered Oct 19 '22 01:10

EMMERICH