I have a web page with the following code snippet:
...
<td nowrap="true" valign="top" width="190px" class="ms-formlabel">
<h3 class="ms-standardheader">
<nobr>
QA Groupe des papiers
<span class="ms-formvalidation" title="Ce champ est obligatoire." > *</span>
</nobr>
</h3>
</td>
...
<td nowrap="true" valign="top" width="190px" class="ms-formlabel">
<h3 class="ms-standardheader">
<nobr>
QA Description métier
<span class="ms-formvalidation" title="Ce champ est obligatoire." > *</span>
</nobr>
</h3>
</td>
<td valign="top" class="ms-formbody">
...
I am developing a JavaScript which is supposed to hide the table rows containing the strings QA Groupe des papiers and QA Description métier.
This is the script:
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("h3.ms-standardheader:contains('QA Groupe des papiers')").closest("tr").hide();
$("h3.ms-standardheader:contains('QA Description métier')").closest("tr").hide();
});
</script>
The script is working fine for the first row, but not for the second. I know the problem is related to the special character é in the second script, but I don’t know how to resolve the problem. Please help, thanks.
The probable explanation is that the character encoding of the JavaScript file has not been declared properly in HTTP headers. Probably the JavaScript file is interpreted as ISO-8859-1 or Windows-1252 encoded but is actually UTF-8 encoded, or vice versa, which means that “é” isn’t what it should be. A simple way to check this out is
alert('é'). Regarding encodings issues, check out the W3C page Character encodings.