mckenzie
mckenzie

Reputation: 121

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?

Upvotes: 0

Views: 55

Answers (1)

Salil
Salil

Reputation: 47542

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

Upvotes: 3

Related Questions