create a new DOM element


/ Published in: jQuery
Save to your folder(s)

this is a shortcut that simplifies making a new dom element.

$("#outerdiv").append(
create("div").addClass("innerDiv").text("This is the inner div")
)


Copy this code and paste it in your HTML
  1. create = function(elementTagName) {
  2. return $(document.createElement(elementTagName));
  3. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.