javascript - This is ugly and there has to be a better way to write it in jQuery -
$(this).parent().parent().parent().parent().find('[name=reply_to_id]'); thats stupid looking, best way can think of writing it. tried parentsuntil('li') didnt work @ , tried parents('li') , closest('li'). isnt there in jquery equivalent of:
$(this).firstparentthatmatchesthis('li').find('[name=reply_to_id]'); if not think ill try submitting jquery core...
here html (long put on pastebin): http://pastebin.com/fypj9wge
working on getting jsfiddle in there...
try this:
$(this).parents("li").eq(0).find('[name=reply_to_id]'); example: http://jsfiddle.net/fvzt9/
but, closest should work well:
$(this).closest("li").find('[name=reply_to_id]'); example: http://jsfiddle.net/fvzt9/1/
Comments
Post a Comment