Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to add class to only one selected row then remove it after selecting it again

$(document).ready( function () {
  var table = $('#example').DataTable();
  
  $('#example tbody').on('click', 'tr', function (event) {
    console.log('td click event');
    table.$('tr.selected').removeClass('selected');
    $(this).addClass('selected');
    
    event.stopPropagation();
});
  
  $('body').on('click', function () {
    console.log('body click event');
    table.$('tr.selected').removeClass('selected');
});
  
} );
Comment

PREVIOUS NEXT
Code Example
Javascript :: find longest even string in array javascript 
Javascript :: router unique validation for mongoose 
Javascript :: how to get value from a label in javascript gtk 
Javascript :: hook redux state with redux extension 
Javascript :: loadash 
Javascript :: javascript get element by class domlist undefined 
Javascript :: conditional statement for node on internet and node local server 
Javascript :: node_modulesexpresslib outerindex.js:508 this.stack.push(layer); 
Javascript :: 5.1.3. Boolean Expressions¶ 
Javascript :: code mirror detect change 
Javascript :: indexable values js 
Javascript :: how we pass 2 args in switch case javascript 
Javascript :: joi for validation 
Javascript :: automatic color change 
Javascript :: hex decode javascript 
Javascript :: after storing array array state is empty 
Javascript :: get all keys of nested object json data javascript 
Javascript :: JavaScript URL Parse Seperate Parsing 
Javascript :: Rest and spread operators in ES6 
Javascript :: subject in angular service file 
Javascript :: A Note about Floats 
Javascript :: regular expression for twitter embedded tweets 
Javascript :: filter array and get index of num 
Javascript :: react redux open another page 
Javascript :: array[-1] not working 
Javascript :: video js ajax 
Javascript :: react Colored rating 
Javascript :: How to check for the properties of an element in the console 
Javascript :: axios 401 unauthorized refresh token multipal request 
Javascript :: triangle sum of odds numbers formula 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =