Reputation: 97
I have a class with css styles already defined. I am now trying to load that page as IFRAME in other site. I want to change the css property of that particular class from the loaded site. Is it possible with jquery. I tried from my end its not getting . can anyone help me...
Upvotes: 2
Views: 183
Reputation: 10378
$(".classname").css("propertyname","setvalue");
example
$(".classname").css("height","50px");
for iframe use like
$("iframe").contents().find(".classname").css("propertyname","setvalue");
reference css
Upvotes: -2
Reputation: 23816
you can also use attr attribute to change value of specific attribute of Html.
$("img").attr("width","500");
Or
$("#tagid").attr("width","500");
or
$(".tagclass").attr("width","500");
But in one page you can't change property of child page which is loaded in IFRAME.
Upvotes: -1
Reputation: 1054
You can add or remove class using jquery as following way
$(".classname").addClass('new-classname');
$(".classname").removeClass('remove-classname');
Upvotes: -2
Reputation: 8706
You cannot change style of elements in iframe
due to same-origin policy.
Upvotes: 7