Hi friends I have tried to add class for iframe html elements using jquery but I can't, I dont know how. could you explain how can this be possibly done. I tried to add class for iframe using query
$("iframe").addClass("myClass");
it worked for iframe but I want to add the class inside the iframe elements in jquery could you help me in this to solve it.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With