I'm trying to get the last field item to focus when doing a 'add another item' on a CCK multiple value field.
Here's my code:
$("#node-form table.content-multiple-table tr.draggable input[type='text']").live("keydown", function (e) {
if (e.which == 13) {
$(this).closest("table.content-multiple-table").siblings("div.content-add-more").find("input.form-submit").mousedown();
$(this).closest("tr.draggable").next().find("input[type='text']").trigger("focus");
return false;
}
});
Clearly this doesn't work because the field is created on AHAH response. :(
Anyone know how to hook into the response to focus the last field? Thanks.