Tilak Raj
Tilak Raj

Reputation: 1499

Detect clicks of iframe elements

I have an iframe with the id=phramecomp which contains several elements such as links and button.Let us suppose i have a hyperlink inside iframe with the id=donuts.I want to set a click event for that hyperlink.How do i achieve that ?

This might be duplication of many questions but still anyone could tell me how to do this one ?

Note:

This is what i have included in my orderonline.php file.

Upvotes: 0

Views: 507

Answers (1)

Rajat Bhadauria
Rajat Bhadauria

Reputation: 260

you can detect click events inside iframe

Lets suppose you an iframe having id="Myframe" and a image in you iframe having id "Myimage"

so for detecting click events inside Myframe in image Myimage you can

 $('#Myframe').loads(function()
 {

 var frame=$('#Myframe').contents();
 frame.find('#Myimage').click(function(){
 //do anything
 });
 });

Upvotes: 1

Related Questions