[jQuery] Chaining $.append

[jQuery] Chaining $.append


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.