I am creating a block of code and run into a problem that makes me curious why ampersands will not be encoded from a WordPress text editor. This code works as expected, giving me the warnings I am looking for when it is embedded directly in the page through a text editor:
// This code works as expected
<script>
jQuery(document).ready(function() {
if (jQuery('select[name=idx-q-PropertyTypes]:first').val()=='') {alert ('it exists');} else {alert ('cant find it');}
jQuery('.dsidx-resp-area-submit input').click(function(e){
alert ("you clicked it");
if (jQuery('select[name=idx-q-PropertyTypes]:first').val()=='') {
alert ('There were no search parameters.');
e.preventDefault();
}
});
});
</script>
The next thing I wanted to do was check for matching conditions. So I changed the code to this:
// This code gives errors
<script>
jQuery(document).ready(function() {
if (jQuery('select[name=idx-q-PropertyTypes]:first').val()=='') {alert ('it exists');} else {alert ('cant find it');}
jQuery('.dsidx-resp-area-submit input').click(function(e){
alert ("you clicked it");
if (
jQuery('select[name=idx-q-PropertyTypes]:first').val()=='' &&
jQuery('select[name=idx-q-Cities]:first').val()=='' &&
jQuery('input[name=idx-q-PriceMin]:first').val()=='' &&
jQuery('input[name=idx-q-PriceMax]:first').val()=='' &&
jQuery('select[name=idx-q-BedsMin]:first').val()=='' &&
jQuery('select[name=idx-q-BathsMin]:first').val()=='' &&
jQuery('input[name=idx-q-ImprovedSqFtMin]:first').val()==''
) {
alert ('There were no search parameters.');
e.preventDefault();
}
});
});
</script>
, , , . , , . &. , &, . , , . , , , , . , . , , . , , , , .
script , script. - , , - , script, ?