The jQuery Javascript library, without which cross-browser Javascript development is unthinkable, has reached version 1.4.1.
Particularly useful is the ability to create new DOM elements. (See this brief discussion, though no anchor link means you'll have to search for "Quick Element Construction.")
What those docs overlook is the .text property, which enables you to create a proper element:
$("#foo").append( jQuery("<div>", {
id: "foo",
text: "I'm a new DIV element",
click: function() {
$(this).css("backgroundColor", "red");
}}));
or even create a nested elements via .html:
$("#foo").append( jQuery("<select>", {html: "<option value='1'>One</option>"}) );
Subscribe to:
Post Comments (Atom)
4 comments:
Does this mean you've abandoned MochiKit?
You won that argument ;)
I still miss a couple MochiKit features, like the operator table, but jQuery very nearly transforms the language, and in a good way.
I'd still prefer Python, of course.
Oh, and MochiKit's interactive interpreter is still the bomb.
I like to use Firebug as my interactive interpreter. With it, you can develop using MochiKit, jQuery, or pure JS.
Post a Comment