Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Jquery highlight highest number

4:14 pm on Aug 3, 2011 (gmt 0)

Full Member

5+ Year Member

joined:Aug 3, 2010
posts: 243
votes: 0

I'm trying to highlight the highest number on each row or a table. I posted the question elsewhere and they provided the following code which works on jsFiddle.net but I can't get it working

<script type="text/javascript">
(function($) {
$.fn.max = function(callback) {
var max = null,
maxIndex = null;

this.each(function() {
var value = callback.call(this);
if (+value === value) {
if (!max || value > max) {
max = value;
maxIndex = $(this).index();

return max !== null ? this.eq(maxIndex) : $();

$('tr').each(function() {
$(this).children('td').max(function() {
var value = +$(this).text().substr(1);
if (!isNaN(value)) {
return value;

I can see that the code works, I imagine it's me missing something when putting the code into my page, hopefully someone can point out what I'm doing wrong.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members