In the below script I added or operator to check the condition, Like if it is “ALL TCP” or “ALL UDP” item must get disabled, Please suggest me to modify the code.
<script type="text/javascript">
function chgJob(pThis, pRow)
{
if ((pThis.value != 'All TCP') || (pThis.value != 'All UDP'))
{
$x_disableItem('f02_' + pRow, false);
}
else
{
$x_disableItem('f02_' + pRow, true);
}
}
</script>
A string can never be equal to
'All TCP'and equal to'All UDP'at the same time, so the condition will always be true.You want to use the
&&operator instead of the||operator:Edit:
As Cerbrus pointed out, you don’t need the
ifstatement at all, you can use the boolean expression directly by inverting it (x==y || x==zis the same as!(x!=y && x!=z)):