$('ul.roles')
.append('<li></li>')
.find('li:last-child')
.append('<select ...>')
.find('select')
.click(...)
Refactorings
No refactoring yet !
paul.wilkins.myopenid.com
August 19, 2009, August 19, 2009 12:55, permalink
* Start from the content that you're going to be adding
* Wrap it with the list item
* Then append it to the roles list
$('<select>...</select>')
.click(function () {...})
.wrap('<li></li>')
.appendTo('ul.roles');
aaronhancock.myopenid.com
April 14, 2011, April 14, 2011 20:09, permalink
Maybe I'm not grasping what you're wanting to do entirely, but is there a reason why you can't do it like this?
var appendMe = "<li><select ...></li>";
$('ul.roles').append(appendMe).find('select').click(...);
Foge
May 1, 2011, May 01, 2011 19:14, permalink
Stands back from the keyobrad in amazement! Thanks!
Stands back from the keyobrad in amazement! Thanks!
calls to find seems kinda hack-ish to me, better way?