I need to bind to an event (say a click
on an arbitrary <input>
) inside an iframe that is created dynamically after the user performs a certain action. The code that appends the iframe AND the code inside the iframe is not mine and I cannot change it in any way (this is a CMS admin panel).
How can I listen to the events using jQuery 1.6 (again, this is not my choice, I'm stuck with it). I thought delegate()
might be what I want:
$('body').delegate('iframe input', 'click', function(e) {
alert('bingo?');
});
But the above does not alert when an input is clicked. The below, however, works as expected:
$('body').delegate('input', 'click', function(e) {
alert('bingo?');
});
But this is outside the iframe.
The src
of iframe
points to the same domain, obviously.
Any help or just a prod in the right direction is greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…