// you’re reading...

You are here: Home » Development » Create elements via DOM and jQuery

Create elements via DOM and jQuery

Today I was rewriting a piece of javascript code that was based on Prototype into a jQuery based script. It involved the creation of some elements and it seemed like jQuery is not as nifty as Prototype is for creating elements. After some research I found a great plugin, however it was not compatible with some browsers regarding the creation of input and select elements at runtime. Therefore I adjusted this script just a little to make it compatible. The jQuery plugin to create elements can be found here.

Feel free to use it and if you have any remarks on this piece code, feel free to share them in the comments.

Discussion

View Comments for “Create elements via DOM and jQuery”

  1. You rule! Thank you for the IE compatible .create plugin update. It saves so much time and headaches. :)

    Posted by Oldboy | May 5, 2009, 2:27 am
  2. It's a pleasure, hope you'll have lots of fun with it Oldboy.

    Posted by rickmans | May 5, 2009, 8:31 am
  3. Thanks a lot, dude… eliminiate IE bugs :)

    I've rewrite your code because i get error when I set content of element as empty: just add additional condition:

    line 71: if(arguments[2] && arguments[2] != '')

    It may be useful…

    Posted by mrbungle | October 30, 2009, 5:55 pm
  4. Thanks, will make a change in the file, so future visitors will have better code :).

    Posted by rickmans | October 30, 2009, 6:02 pm
  5. Thanks very much for the code. I'm using it in a project at http://code.google.com/p/jscom/. This plugin currently works, though there doesn't yet exist any documentation or examples.

    The idea has been to manage all client/server communications in JSON, then have the client dynamically create the DOM. A complete separation of the logic an presentation layers, also reducing server CPU needs and allowing complete template control. I'll give an update once a live demo is available.

    Posted by T.Norris | March 31, 2010, 2:44 am

Post a comment

blog comments powered by Disqus

Twitter Remote