Reputation: 27723
why does this not return the element? it returns the href attribute on the tag
var tst = document.body.appendChild(document.createElement('a'));
tst.setAttribute('href', 'http://www.test.com');
alert(tst);
Upvotes: 0
Views: 63
Reputation: 186662
It does return an element..... .nodeType
is 1
and .nodeName
is A
if you actually test it.
Anchor elements' toString method probably just return the url for certain DOM implementations.
Upvotes: 0