I suggest to use jQuick. In your case you can create the code using:

$('#myAnchor').append( $.DIV( id: myIdVar, 'class': myClassvar} )

jQuick is at http://jquick.sullof.com/
In the next days I will release a new powered version.



nrwsteff ha scritto:
short question:

what is the recommanded/better/fastest (memory footprint/execution time)
jQuery way to create dynamic content?
the length of code is not so important for me. or should i use one of the DOM creation plugins?

a)
var myIdVar = 'id1';
var myClassVar = 'class1';
$('<div></div>').attr({'id':myIdVar,'class':myClassVar}).appendTo('#myAnchor
');

or
b)
var myIdVar = 'id1';
var myClassVar = 'class1';
var myHtml = '<div ';
myHtml += 'id="'+myIdVar+'" class="'+myClassVar+'"></div>';
$('#myAnchor').append(myHtml);

regards steff


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to