I am trying to implement a manual sorting feature for a table of persons. The idea is to allow users to select a person by clicking on the row, then select another person by clicking on them, and have the two selected rows switch positions without using drag and drop functionality.
While I have managed to select one row successfully, I am facing difficulty in selecting the second row. My current train of thought involves potentially using jQuery's replaceWith method to switch the positions of the selected rows.
$(document).ready(function(){
var selections = new Array(2);
$("tr").click(function() {
var selected = $(this).attr('id');
//highlight selected row
$(this).toggleClass("marked");
})
});
I have set up a fiddle demonstrating my progress: http://jsfiddle.net/zLz929xy/3
Any suggestions or guidance on how to tackle this issue would be greatly appreciated.