jQuery's trim is used like:
var str = $.trim(str);

On Jul 31, 10:24 am, Magnificent
<imightbewrongbutidontthin...@gmail.com> wrote:
> 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');
>           }
>      });
>
> }
>
>

Reply via email to