Thursday, April 30, 2009

[jQuery] .html() causes null IE

Hi,
I am pretty new to jQuery and I am using the tablesorter plugin and I
am getting a .html() is null or not an object error within a custom
parser

the code

var ts = $.tablesorter;

// add parser through the tablesorter addParser method
ts.addParser({
id: "empnames",
is: function(s) {
return false;
},
format: function(s) {
// make an object of the string
var strobj = $($.trim(s));
return strobj.find("span").html().toLowerCase();
},
type: "text"
});

In that case is an object but as soon as I add .html() it returns null
in IE. It works fine in Safari and Firefox.
I am using jQuery 1.3.2 and tablesorter 2.0
I am trying to make it sort the text that's in a span. If anyone has a
better technique to do it it's also appreciated.

thanks

No comments: