tags:

views:

33

answers:

1

Hi i have the following:

if( $(this).val() == "Next Step »" )

and HTML:

<input type="submit" name="pageToEditButton" id="pageToEditButton" class="submitButton" rel="getChosenPage" value="Next Step &raquo;" />

this does not return TRUE anyone know how to fix?

regards

+1  A: 

In the HTML attribute value, the &raquo; character reference is replaced by the character it represents. But in JavaScript it’s not. So there you need to to use the character itself, so "Next Step »".

Gumbo
comes up as :if( $(this).val() == "Next Step »" )if source code
Phil Jackson
@Phil Jackson: What character encoding do you use in JavaScript and HTML?
Gumbo
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
Phil Jackson
@Phil Jackson: That’s what you HTML document says. But more important, what does your HTTP header say? And what about your JavaScript code? Is that directly embedded into your HTML document or is it a separate resource?
Gumbo
directly embeded
Phil Jackson
@Phil Jackson: Then again the question what encoding is acutally used. According to your code snippet it’s rather ISO 8859-1 (Latin-1) than UTF-8. So you might want to check the HTTP header of the response.
Gumbo
You can also use a JavaScript string literal escape to avoid encoding issues (though you should really fix them eventually and UTF-8 is the best way to go). `'Next Step \xBB'`
bobince