jQuery Plugin To Highlight Different Values In Table - oddMenOut

File Size: 2.9 KB
Views Total: 1937
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Highlight Different Values In Table - oddMenOut

oddMenOut is a jQuery plugin to compare and highlight table cells that are different from the others. 

How it works:

  • Get a list of each unique value as well as the number of times it's found.
  • Find the value that has the highest number.
  • Find the element in the unique array at the index
  • Highlight the rows that are not the value of the highest number.

See also:

How to use it:

1. To get started, just include the jQuery oddMenOut plugin after jQuery library:

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery-oddMenOut.js"></script>

2. And then call the oddMenOut() function on your existing html table. That's it.

$("table.oddMenOut").oddMenOut();

3. Change the default highlight color in the jquery-oddMenOut.js.

$this.find("tr td:nth-child(" + (cell_index + 1) + "):not(:contains('" + highest_element + "'))").css('background-color', '#F44336');

This awesome jQuery plugin is developed by fiftynineseconds. For more Advanced Usages, please check the demo page or visit the official website.