Unless there are other problems, for example, if you reuse the # test1, ... fields for more processing, yours should be good.
If you extract any of the values ββagain to do something, I would recommend storing the result of $ ('# test1') in a variable, so you do not need to query dom.
Example:
var t1 = $('#test1'); if((t1.val() == 'first_value')||($('#test2').val() == 'second_value') && ($('#test3').val()!='third_value')|| ($('#test4').val()!='fourth_value')) { t1.val('Set new value'); }
It also improves the readability of the string;)
source share