Simple answer:
DOM nodes are created by just writing the html in side of the jQuery
$('#divName').append('tabletrtd/td/tr/table');
is equivalent to
divResult = document.getElementById(divName);
table = document.createElement(table);
tr = document.createElement(tr);
td =
On Mar 4, 11:28 am, SeeVik vikramvmalhotra1...@gmail.com wrote:
Hello all,
I am using Symfony with jQuery plugin. The thing is I am getting some
data from database in JSON format and I want to use jQuery to display
a table using that data on the fly. I was wondering is jQuery the best
way
$('#divName').append('tabletrtd/td/tr/table');
gets you the same effect. Without jQuery I would probably opt to do
this (since I long gave up using DOM methods much):
var divResult = document.getElementById(divName);
divResult.innerHTML = 'tabletrtd/td/tr/table';
it's quicker performance
This isn't jquery-specific, but I've been using this for a couple years
now to generate html from json data:
http://code.google.com/p/trimpath/wiki/JavaScriptTemplates
works great.
- Jack
SeeVik wrote:
Hello all,
I am using Symfony with jQuery plugin. The thing is I am getting some
data
Thanks for the reply Jack. the JST Template looks cool. I will surely
look into it.
Just for the record, if anybody can throw some light on the original
question, it would be really helpful.
I don't really want to be left clueless about this thing in jQuery.
Thanks and Regards
Vikram
On Mar 4,
Hi Vikram, jQuery is fine for this. Here's a bunch of info about using
.append() for table rows:
http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly
- Jack
SeeVik wrote:
Thanks for the reply Jack. the JST Template looks cool. I will surely
look into it.
Just for the
Generating DOM manually as you have in your example is probably the
slowest method you can use. Using a document fragment would be much
faster and is the way that jQuery 1.3 does its appending. Straight HTML
insertion is the fastest though.
One method that I've used is to basically roll out
7 matches
Mail list logo