I’m having a problem with jquery trim function. I’m trying to convert an html string to text and then check if that string is empty, the way I’m doing this is creating a div, setting the html of the div and then getting the text() of that div. That works ok, but take this example:
var text = $("<div/>").html(" ").text(); //text is OK it returns " "
var trimmed = $.trim(text); //in IE it returns me again " " (a whitespace)
In chrome and ffox it works ok, but not in IE. I’m using jquery 1.6.1.
Any ideas?
Thanks in advance
Well, I don’t know if the problem was with the encoding. I ended up using this check to see if it was empty: