Hello, I relatively new to Javascript in general, but I've been attempting to use jQuery for a while, I ran into a snag today and I hope someone can help, here is what I have so far:
var id = $('#invoice_line_item_rows .item.description textarea').attr ("id") $("#add_line").click(function() { $("#invoice_line_item_rows").clone().appendTo ("#invoice_line_items").effect("highlight", {}, 600, function() { $(id).replaceWith("invoice_lines_attributes_new_" + $(this).val() +1 + "_description"); }); }); I'm trying to clone #invoice_line_item_rows and append to #invoice_line_items which works just fine, the problem I'm having is with the id in the text area #invoice_lines_attributes_new_1_description that's what it looks like. I'm trying to grab the newly created row textarea and increase the number by +1, I think I'm close, or I could be completely wrong, and idea what I could do or change to get this working? Thanks for anyone's time and help!