Posted By

TonyBentley on 07/28/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

koyotebr


create a new DOM element


 / Published in: jQuery
 

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

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

  1. create = function(elementTagName) {
  2. return $(document.createElement(elementTagName));
  3. }

Report this snippet  

You need to login to post a comment.