var fieldset = document.getElementsByClassName("fieldset"); var link = document.createElement('a'); link.setAttribute('href', 'javascript:bbcode(\'[youtube]\',\'[/youtube]\')'); link.setAttribute('style', 'margin-left: 10px; vertical-align: 4px;'); link.textContent = "YouTube"; fieldset.item(0).querySelector("div").appendChild(link);