How to find an element in IFrame using JQuery


You have an iframe on the page showing some document, and you want to find an element inside the iframe using JQuery. You can get iframe contents using contents function and then you an use find method to fine an element inside iframe as shown in the following example code.
$("#iFrameID").contents().find("#someDivID").addClass("colorfulborder");​

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments