Stephen, $(id).replaceWith("invoice_lines_attributes_new_" + $(this).val() +1 + "_description");
You should take arithmetic operations in paranthesis when concatenating these with strings, or javascript will append these also as strings. Cheers Rasit 2009/2/25 Stephan Veigl <stephan.ve...@gmail.com> > > Hi Stephen, > > could you post some HTML snippets as well? > > What should $(this).val() be? Should the ID be dependent of the > textarea input or should it simply be the row number? > > by(e) > Stephan > > 2009/2/25 stephen <skore...@gmail.com>: > > > > 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! > > > -- M. Raşit ÖZDAŞ