F1e3ab214a976a39cfd713bc93deb10f

calls to find seems kinda hack-ish to me, better way?

$('ul.roles')
      .append('<li></li>')
      .find('li:last-child')
      .append('<select ...>')
      .find('select')
      .click(...)

Refactorings

No refactoring yet !

Aacfa176a8d73ca75b90b6375151765a

paul.wilkins.myopenid.com

August 19, 2009, August 19, 2009 12:55, permalink

No rating. Login to rate!

* 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');
55502f40dc8b7c769880b10874abc9d0

aaronhancock.myopenid.com

April 14, 2011, April 14, 2011 20:09, permalink

No rating. Login to rate!

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(...);
4390db1e5b59e7f600443a218c427d29

Foge

May 1, 2011, May 01, 2011 19:14, permalink

No rating. Login to rate!

Stands back from the keyobrad in amazement! Thanks!

Stands back from the keyobrad in amazement! Thanks!
4390db1e5b59e7f600443a218c427d29

Foge

May 1, 2011, May 01, 2011 19:14, permalink

No rating. Login to rate!

Stands back from the keyobrad in amazement! Thanks!

Stands back from the keyobrad in amazement! Thanks!
4390db1e5b59e7f600443a218c427d29

Foge

May 1, 2011, May 01, 2011 19:14, permalink

No rating. Login to rate!

Stands back from the keyobrad in amazement! Thanks!

Stands back from the keyobrad in amazement! Thanks!

Your refactoring





Format Copy from initial code

or Cancel