我将如何改变这个的HTML:
<div class="name">President Speech</div>多数民众赞成在这个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>我试过了:
$('#videoBox7 .name').html('President Speech TEST!');但那似乎不起作用?
更新
看起来它在视频div之后没有触发运行JS来填充它正在寻找的HTML。
<script type="text/javascript"> $(document).ready(function() { $('#videoBox7 .name').html('President Speech TEST!'); }); </script>我已将填充视频的JS上传到http://pastebin.com/DNBPNQUQ
更新2
通过放置$('#videoBox7 .name').html('President Speech TEST!');找到了实现这一目标的方法$('#videoBox7 .name').html('President Speech TEST!'); 在onPlaylistLoad js的onPlaylistLoad函数中。
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.
最满意答案
只有在将HTMLDivElement添加到DOM后才能运行此代码:
$(function(){ $('#videoBox7 .name').html('President Speech TEST!'); });在与作者聊天之后,很明显问题出在Brightcove Video Player加载新元素以反映视频播放列表。 这一点的明确解决方案是将Brightcove的玩家的事件系统与其元素添加后的响应结合起来。
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.
更多推荐
发布评论