jQuery changing html inside a div class thats inside a div

html, jquery

Solution

Be sure to run this code only after the `HTMLDivElement` has been added to the DOM:

$(function(){
    $('#videoBox7 .name').html('President Speech TEST!');
});

Following a chat with the author, it became evident the problem was with the Brightcove Video Player loading new elements to reflect a playlist of videos. The clear solution as this point was to tie into the event-system of Brightcove's player to respond after their elements have been added.

Problem

How would i go about changing just the HTML of this: ``` <div class="name">President Speech</div> ``` Thats inside this div: ``` <div class="videobox fl showsearchvideo" id="videoBox7"> <div class="videothumb"> <img src="http://brightcove04.o.brightcove.com/xxxxx/xxxx_xxxxx_xx-xxxxxx.jpg?pubId=xxxxxxx"> </div> <div class="name">President Speech</div> </div> ``` I've tried: ``` $('#videoBox7 .name').html('President Speech TEST!'); ``` But that does not seem to work? update Seems that its not firing after the videos div runs the JS to populate the HTML thats its looking for. ``` <script type="text/javascript"> $(document).ready(function() { $('#videoBox7 .name').html('President Speech TEST!'); }); </script> ``` I have uploaded the JS that populates the videos to http://pastebin.com/DNBPNQUQ Update 2 Found a way to achieve this by placing the `$('#videoBox7 .name').html('President Speech TEST!');` inside the `onPlaylistLoad` function of the brightstar js.

Original source

Related problems