jQuery Access iframe content element

/ / 0 Comments

jQuery access iframe content: Here in this article we are going to learn how jquery gets iframe content. In short access the iframe div element and apply some CSS.  Suppose you have an iframe on your webpage and want to get data from iframe content or want to modify its style or css. Then first we need to access the iframe and its content.

Hereby using .contents() we get the iframe content dom element, and later with the below jquery code, we are able to access iframe and content and add our custom style css.

$(document).ready(function(){
	var iFrameDOM = $("iframe#frameID").contents();
	iFrameDOM.find(".page").css("background-color", "#fff");
});


Thank you for reading, pls keep visiting this blog and share this in your network. Also, I would love to hear your opinions down in the comments.

PS: If you found this content valuable and want to thank me? 👳 Buy Me a Coffee

Subscribe to our newsletter

Get the latest and greatest from Codepedia delivered straight to your inbox.


Post Comment

Your email address will not be published. Required fields are marked *

0 Comments