简体   繁体   中英

jquery javascript question

var val = $("#desc").val(); // input box var val2 = $("#type").val(); // select box if((val=='') || (val2 == '')) { alert("err"); } else { // codes }

when i select dropdown and not type anything on inputbox, the alert err still comes out?

how to make it when dropdown is selected, it goes to else clause?

var val = $("#desc").val();   // input box
var val2 = $("#type").val();  // select box
if((val=='') && (val2 == ''))
     {
     alert("err");
     }
else { // codes }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM