I've this code into Content editor Web part in Display Form of Sharepoint 2007:
<p>
<script src="/GCAP/JQuery/jquery-1.5.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
var sField1 = $('h3:contains("sino")').closest('td').next('td').text();
alert("sField1:"+ sField1);
if (sField1 == "No"){
alert("prove");
}
});
</script>
</p>
The variable sField1 is equal to "No", but when check it i don't show alert("prove").
Why, even if the value is the same, it doesn't go in "then" clause?
Thank for your help.
Regards, Francesco
Description: Remove the whitespace from the beginning and end of a string.
if($.trim(sField1) == "No") { alert('prove') } ;