Helpful jQuery/Prototype plugin
March 10th, 2006
- Category:
- JavaScript,
- Web Development,
- jQuery
Michael Geary has written an helpful jQuery/Prototype plugin that makes creating new DOM nodes much more convenient than using document.create all the time.
If you want to create a new p node with a class attribute named "foo" you just have to write:
var myP = $.P({ Class: "foo" });
Nested nodes anyone?
var myP = $.P({ Class: "foo" }, $.A({ href: "http://www.example.com" }, "My Link"));
By the way, couldn’t agree more: Free beer and free speech
. Amen.
Comments are closed.