Try.. $("<li id='prod-" + data.Id + "'></li>").text (data.Name).appendTo("#prods-list");
cody On Mon, Jul 13, 2009 at 4:27 AM, dnagir <dna...@gmail.com> wrote: > > Hi, > > I'm using the code to create DOM. But the append returns current > element and not the one it has created. So after I create some > elements via append (or similar) I have to query to obtain the > element. > Isn't there other way of doing it? > > Instead of this code > : > var domId = "prod-" + data.Id; > $("#prods-list").append("<li id='" + domId + "'></li>"); > $("#" + domId).text(data.Name); > > I would like to write (which is incorrect now): > $("#prods-list").append("<li id='prod-" + data.Id + "'></li>").text > (data.Name); > > What is the correct way of chaining the elements creations? > > Cheers, > Dmitriy.