Reputation: 21
I have this code for getting the attributes of an html element inside an iframe
.
Code:
$("#frameID").contents().find("#htmlelementID").attr("myattr");
My dilemma here is i want to add a new attribute on the html element inside my iframe.
I'll truly appreciate every idea that will help me on this.
Upvotes: 0
Views: 4614
Reputation: 388316
Use the setter version of .attr()
$("#frameID").contents().find("#htmlelementID").attr("newattr", 'newvalue');
Upvotes: 2
Reputation: 10378
by attr
$("#frameID").contents().find("#htmlelementID").attr("attrname", 'atrvalue');
by prop
$("#frameID").contents().find("#htmlelementID").prop("attrname", 'atrvalue');
Upvotes: 0