[jQuery] $(this).text().trim().toLowerCase() throwing errors in IE
Hi all,
I'm running into an IE7 problem where the Visual Studio debugger is
saying:
"Microsoft JScript runtime error: Object doesn't support this property
or method"
Visual Studio is highlighting this line as the problem:
if($(this).text().trim().toLowerCase() === subToBold
$(this) should be the li.
text() should be the text/content of the li.
I then trim/lowercase it.
The pertinent code block is below, the "lis" are list items I'm
iterating over, I'm checking if the text of the li is equal to a
dynamically populated hidden form field on the page. Code all works
fine in Firefox, but throws errors in IE, any ideas why?
if(url[7] === 'default.aspx'){
//if we're on default.aspx we don't want to bold the hidden form
field subnav so do nothing here
} else {
//bold the hidden form field subnav
lis.each(function() { //iterate over each subnav to bold
if($(this).text().trim().toLowerCase() === subToBold) { //
text of each subnav, trimmed to strip whitespace
$(this).css('font-weight', 'bold');
}
});
}