jquery - How do I check if an element exists inside an iframe? -


$('#frame').load(function(){          settimeout(function() {             alert($("#frame a[href=check]").length);          },2000);             }); 

the alert shows 0, iframe loads correctly , link exists.

to fetch contents of iframe try

$('#frame').load(function () {     settimeout(function () {         alert($('#frame').contents().find('a[href=check]').length);     }, 2000); }); 

.contents()

the .contents() method can used content document of iframe, if iframe on same domain main page.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -