it works (for the moment not in IE but in Firefox; others still not tested); we have to fire a load event for the iframe.
main page: $().ready(function() { function local_alert() { alert("calling from main page"); }; var iframe=$('iframe#id_iframe'); //the id of the iframe iframe.load (function() { var submit=iframe.contents().find("#submit"); //submit is the id of the "submit" button in the iframe submit.click( function() { local_alert(); //it calls now a script from the main page }); }); pere roca wrote: > > hi, > someone knows how to execute events from the main page but when something > in the iframe happens? > I have an iframe made by jqModal, and I can access divs, forms... by > something like this; > > //iframe and the 'name' of the iframe > $('iframe#info').contents().find('#id') > > But trying to fire an acion when a form in the iframe is clicke, from > main page: > > > $('iframe#info').contents().find('#contactForm').submit(function() { > > //console.info($('iframe#info').contents().find('#contactForm')); > alert("eiiii"); > }); > > it fails. I would like to work like this because I have lot of js code > in the main (not the iframe page). > Maybe Is not compatible find() with event firing? > > Thanks. > Pere > -- View this message in context: http://www.nabble.com/iframes-and-event-firing-tp14771591s27240p14776673.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.