A quick tag creator for jQuery

News


29 sep: Fixed readOnly link in IE.
22 sep: Fixed problems using jQuery 1.2.
29 aug: Fixed problems using jQuery 1.1.4 in IE.
8 jul: Fixed a bug with names of iframe in IE.
12 jul: Fixed bug with label in Safari 3.

Brief history


During the development of the first releases of Passpack, I adopted Easy DOM Creation by Michael Geary to quickly manage the DOM elements. But, in january, with the beta4 version of Passpack I needed to overcome Michael's library's limits (due to the compatibility with Prototype). So I developed jQuick. I hope you find it useful.

How it works


Suppose you want to obtain the following html code:

<div class="big">
  <span id="one" class="ps">Hello Joe<i>!</i></span>
</div>

Using jQuick you could create the corresponding DOM elements with the following code:

$.DIV({'class':'big'},
  $.SPAN({id:'one','class':'ps'},
    'Hello Joe', $.I('!')
  )
);


Now suppose that you want to append to the big div an animated SPAN element. You could write:

$('#big').append(
  $.SPAN(
    {id:'one','class':'ps'},
    'Hello Joe'
  ).animate({left: 50,opacity:'show'},1000)
);


jQuick supports HTML code. So you could write:

$.DIV({'class':'big'},
  '<span class="ps">Hello Joe<i>!</i></span>'
);

It is useful if you have to pass the innerHTML of one tag to another.


jQuick supports events if passed as attributes, even with IE. For example, instead of

$.FORM({},
  $.LABEL({'for':'one'},"Digit"),
  $.INPUT({id:'one'}).click(setValues)
).bind('submit',function(){return false;});

you could write:

$.FORM({onsubmit:'return false;'},
  $.LABEL({'for':'one'},"Digit"),
  $.INPUT({id:'one',onclick:'setValues()'})
);


jQuick adds support for LABELs in Safari 2 and preserves spaces.

Download


jQuick 1.3.6 for jQuery, 29 september 2007

Note


jQuick is dual licensed under the MIT and GPL licenses.

It supports all XHTML Strict and Frameset DTD tags but you can add what you want.

jQuick was inspired by DOM Creation by Michael Geary.

 

Let me know your comments.


(c) 2006 Francesco Sullo