function auditUpdate(newval) {
jQuery("#audit").val() = newval;
jQuery("#auditForm").submit();
}
Why do I get an error where I try to assign newval to the #audit
value?
In jQuery you assign a new value with:
jQuery("#audit").val(newval);
val()
without a variable works as a getter, not a setter.
jQuery doesn't complain about it. But your JavaScript interpreter does. The line
jQuery("#audit").val() = newval;
is invalid JavaScript syntax. You can't assign a value to the result of a function call. Your code says "call val
, get the return value -- and then assign newval
to the return value." This makes no sense.
Instead:
function auditUpdate(newval) {
jQuery("#audit").val(newval);
jQuery("#auditForm").submit();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With