jQuery - Bind an event to iframe element

Binding an event to an iframe element is possible using contents() method. Here i am attaching an keyup event to a body field inside an iframe. Check the sample code below,

$('#iframe-wrapper iframe').contents().find('body').keyup(function() { // write your logic here. }

 

Category: