Displaying 1 result from an estimated 1 matches for "my_anchor".
2007 Aug 20
3
Contribution on extending createElement
Hi all,
I work a lot with scripts that modify the DOM, and I have always found
quite annoying that the code would always get very verbose as soon as
I wanted to create even simple structures :
var my_div = document.createElement(''div'');
var my_anchor = document.createElement(''a'');
my_anchor.setAttribute(''href'',my_link);
var my_text = document.createTextNode(''here is my link'');
my_anchor.appendChild(my_text);
my_div.appendChild(my_anchor);
$(document_element).appendChild(my_div);
... I guess...