JQuery Row Selection & Changing Styles

JQuery can be extremely FAST as compared to normal Javascript routines. Like in case we want to select a row in html table, and want to change the style of that row, and also remove selected style from other rows of the same table. (Options are limitless)

function SelectRow(rowObject)


    $(“#tableId TR “) .removeClass(“SelectedRowStyle”).addClass(“OriginalRowStyle”);//removes SelectedRowStyle and add Original

  //Option – more faster can be $(“#tableId TR .SelectedRowStyle”) .removeClass(“SelectedRowStyle”).addClass(“OriginalRowStyle”);

   $(this).removeClass(“OriginalRowStyle”).addClass(“SelectedRowStyle”); //removes the Original Style and add Selected class


Now, if wanted to the same in Javascript we would need to loop through all rows and then search for selected row and do all other stuff we need to for javascript. This is simple in its own way…