Saturday, 15 February 2014

how to know click event has been fired or not in jquery? -


I have the following problem to solve.

I have some lines of data when I click on a line then the row color is changed and when I click on the second line, then the color of the previous selected row should be normal and the current The row should be highlighted with color. This is done through the following code. Click <$> $ (this). $ (This) .addClass (

  check = function () {$ ('tr') (function () {$ ('tr'). "Coloradd");}); };  

But now a complexity requirements have been added. When I press the key of the shift and select several rows to highlight the selected rows, can anyone help me with this?

You can check changes like this (I also included a little customization):

  $ ('tr'). Click (function (e) {// only if the shift key is not caught if run (if! E.shiftKey) $ ('tr.coloradd'). RemoveClass ("coloradd"); // Always current row $ (This). AddClass ("coloradd");});  

No comments:

Post a Comment