Reputation: 115
I am editing a system and I noticed a weird tag <object>
I tried to search for it but didn't get any luck.
the code looks something like this :
<object width="50" height="10" tabIndex="12345" id="test" classid="ghjkl" />
so what I need to do is I need to edit the value of this textbox but I didn't get any luck with that. I have tried to grab it by id (and it worked) but I couldn't get the exact value or edit it's value. any ideas ?
Upvotes: 0
Views: 321
Reputation: 68933
The HTML
<object>
element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin.
There is no value
attribute for <object>
element. Please check MDN link for all the available attributes present in <object>
.
But there is data
attribute which you can modify:
document.addEventListener('DOMContentLoaded', function(){
document.getElementById('test').setAttribute('data', 'new-movie.swf');
console.log(document.getElementById('test').getAttribute('data'));
}, false);
<object width="50" height="10" tabIndex="12345" id="test" classid="ghjkl" data="movie.swf"
type="application/x-shockwave-flash"></object>
Upvotes: 2
Reputation: 11
Hi if you want to get the value from object tag you can use this code.
HTML
<object width="50" height="10" tabIndex="12345" id="test" classid="ghjkl" />
JavaScript
var t=document.querySelector("#test");
var htmlDocument= t.contentDocument;
If you have jQuery in your project and want to remove the object element you can use the remove method.
$("#test").remove();
Upvotes: 1