I think you should use the 'load' event helper.Something like this: var iframe = document.getElementById('iframe_id); $(iframe).load(function() { // here you can manipulate the iframe content var doc = iframe.contentDocument; $('#someDiv', doc).click(function() { // code here }); });
On Feb 2, 9:43 pm, jquertil <til...@gmail.com> wrote: > I did this: > > $('body').append('<iframe name="myFrameName3" src='... etc... > > now I want to attach a click event to something inside that frame. > Does anyone know why the context parameter of the click() below does > not work? I can't get the alert to show up. > > $('#someDiv', top.frames['myFrameName3'].document).click(function(){ > alert( $(this).attr('id') ); > > });