vineet
vineet

Reputation: 14236

Unable to auto click/trigger on button of iframe

Here, Iframe is auto generated by js script. Now i want to click by trigger a button but i unable. Here is jsfiddle.

I have tried all possible way from my side but unable to get solution.

Code:-

$(function(){ 
   $(window).load(function(){   

   alert($("iframe.tableauViz").contents().find('#primary-auth').html());


   $("iframe.tableauViz").contents().find('#primary-auth').click(function(){
    alert('clicked'); 
   });

 });

})

Upvotes: 1

Views: 755

Answers (1)

Gaurav Aggarwal
Gaurav Aggarwal

Reputation: 10177

Well if you write function on you page for element on <iframe> it will not work. You can't apply function on anything in <iframe>.

But yes if <iframe> is on you domain and you have access to if write function on that page which you are calling in <iframe> of different page.

Elements in iframe are not accessible from function on different page.

Upvotes: 4

Related Questions