1

How to target an element that comes under the iframe tag to style with css or javascript?

any help will be apreciated

thanks in advance

Rohit
  • 92
  • 1
  • 1
  • 12

3 Answers3

1

You can access frames data only when your web-site (which is loaded inside this frame) support CORS

If supports - you can access data using:

window.frames[0].document.getElementBy[Id | ClassName | ...]
VadimB
  • 5,533
  • 2
  • 34
  • 48
0

You can access elements in an iframe by giving the element a class or id and making the proper adjustments in css. To access a class in css you should have a dot "." before the name of the class and "#" if you want to access an id. In javascript you can access the element by giving it an id and using getElementById("name of id") or giving it a class name and using getElementsByClass;

JAlmazan
  • 40
  • 9
0

you can use this to access to an iframe from the parent page:

$('iframe').contentWindow.document.[body|head...][getElementById/ClassName...];
Tarik FAMIL
  • 439
  • 5
  • 9