Prakadeessh Arunachalam Prakadeessh Arunachalam - 1 year ago 83
Ruby Question

AJAX inserting a row at any position in a table

I am building a rails app and I use AJAX to populate the newly created entry in the table(in views folder).

$("#career_objective_table tr:first").after('<%= @career_objective.priority %>')

With the above code, I an able to insert it at the top.
Is there a way to insert at any position? (Like in the second row or third row) ?

Answer Source
$("#career_objective_table tr:nth-child(4)").after('<%= @career_objective.priority %>')

Replace 4 with any number

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download