In my application I am trying to hide a table based on a condition. I am using simple javascript function to hide the table.
the function is failing on the following line
if ((image1.trim() = '') && (image2 != '1')) {
giving error
'Microsoft JScript runtime error: Cannot assign to a function result'.
Here is the code.
Html code:
<table id="tblImage" cellpadding="0" cellspacing="0" style="padding:2px 0px">
<tr>
<td>
<div id="otherImages"></div>
</td>
</tr>
</table>
Javascript function:
function DisplayTable() {
var image1 = document.getElementById('ctl00_ContentPlaceHolder1_image1').value;
var image2 = document.getElementById('ctl00_ContentPlaceHolder1_image2').value;
if ((image1.trim() = '') && (image2 != '')) {
jQuery('#tblImage').hide();
}
}
=is not the same as==;) And to push it one step further. Keep using the strict versions of the comparison operators link :)