jQuery Plugin To Highlight Different Values In Table - oddMenOut
File Size: | 2.9 KB |
---|---|
Views Total: | 1957 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
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:
- jQuery Plugin To Highlight Duplicate Table Cells - duplifer.js
- Highlight Largest/Lowest Value In Each Row Or Column - tableMinMax
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.