var div = document.getElementById("yourDivElement");
var input = document.createElement("textarea");// this isgreat if you don't need to put contents into the text area dynamically.an empty text area.
var button = document.createElement("button");
input.name = "post";
input.maxLength = "5000";
input.cols = "80";
input.rows = "40";
div.appendChild(input); //appendChild
div.appendChild(button);
$('<tr>').append(
$('<td>').append(
$('<a>', {
href: o.link,
text: o.word,
onclick: function() {someFunc(o.string);}
}) )
I have a list that I need to insert an new anchor with javascript(because you should always use native javascript when possible), and build its attributes using jquery.
To create the new anchor :
var myNewTag = document.createElement('a');
var mynewthingy=document.createElement(‘a’);
mynewthingy.setAttribute(“href”, “http://dwdenney.com”);
mynewcategory.innerText=”visit deedubs”;
$(“#mydomobject”).append(“<li id=’atempnameremovewhendone’></li>”);
var atempnameremovewhendone = document.getElementById(“atempnameremovewhendone”);
atempnameremovewhendone.appendChild(mynewthingy);