开发者

How can I check whether a button (wpv_1266351) in a frame does or does not exist using Jquery or Javascript?

iframe Info: id="AssessmentsIFrame"

button Info: id="wpv_1266351"开发者_StackOverflow


$('#AssessmentsIFrame').contents().find('#wpv_1266351');


First, the iframe HAS to be on the same domain name, otherwise you can't get to anything in it.

var ifr = $('#'),
 ifrDoc = ifr.contentDocument || (ifr.contentWindow && ifr.contentWindow.document) || ifr.document,
 button = ifrDoc.getElementById('wpv_1266351');

button will either be null or a reference to your button. It's not really any simpler using jQUery since jQuery doesn't know how to get the iframe document reference by itself.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜