Add class for interior iframe html elements using Jquery

You need to use the function contents() to get the document inside the iframe, and then you have to use the function find() to select the element inside the iframe.

$("iframe").contents().find("#element").addClass("myClass");

This solution is working well. First you need to create javascript function like this

function addingClass()
{
    $("#iframe").contents().find("#element").addClass("myClass");
}

Then on your iframe control just add onload="addingClass();"

Hope this help.

Tags:

Jquery

Iframe