On 22/02/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > If I have > > $(this).parents("div.sidebarToDo").find("td.sidebarText").empty().append('<input > type="text" value="" size="10" class="editableItem">'); > > What is the best way to get a reference to the newly created text field? > Note that it does not have an ID and I would prefer a more generic way of > finding it other than "input.editableItem" because on PC IE 6, if I insert > multiple text fields, like the above, this call ... > > $(this).parents("div.sidebarToDo").find("input.editableTDItem"); > > only returns a correct reference for the first time a textfield is added. I > cant get the most recent addition with the above call if there had been text > fields added in the past. > > Thanks, please let me know what info I can provide to make this question more > clear, - Dave
You could try this: var editableitem = $('<input type="text" value="" size="10" class="editableItem">'); $(this).parents("div.sidebarToDo").find("td.sidebarText").empty().append(editableitem); editableitem.change(checkText); _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/