user587159 user587159 - 1 year ago 68
HTML Question

How to change HTML Object element data attribute value in javascript

How do you change HTML Object element data attribute value in JavaScript?

Here is what i am trying

<object type="text/html" id="htmlFrame" style="border: none;" standby="loading" width="100%"></object>

var element = document.getElementById("htmlFrame");
element.setAttribute("data", "http://www.google.com");

Answer Source

and in jquery:

$('element').attr('some attribute','some attributes value')

i.e

$('a').attr('href','http://www.stackoverflow.com/')