I’m using the TableDnD jQuery plugin to make a table row sortable (http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/). Using FireFox, I used console.log(row) to see what the value for row was onDrop. In doing so, Firefox spit out this:
<tr id="row_2" class="" valign="top" style="cursor: move;">
How can I pull out the id from this string, or more importantly, I really just need the number (2 in this example) when the row is dropped. The ultimate goal is so I can show a message to the user that the sorting has been updated and I’d prefer to not use an alert box because then the user has to dismiss it for each item dropped.
Assuming you have the html for the row (or the actual DOM row object) in a varable called tr:
Please also visit the following jsFiddle: http://jsfiddle.net/JspRR/1/