swisstony
swisstony

Reputation: 1715

how to test if TWO input fields are empty?

Hi can someone please tell me what wrong with this line (getting an error...)

if ($("input[type=file]").val().length !==0) || $("#book_map_keys").val().length !==0) {
// do something
}

As you can probably see, I am testing to see either of these two input field are empty. (they don't both have to be empty)

If you could advise how this should be re-written, I'd be much appreciated.

//Edit: the error is pointing to the 'OR' pipe character. Adding those quotes didnt fix it, thanks anyway David

Upvotes: 0

Views: 1700

Answers (1)

mamadrood
mamadrood

Reputation: 757

You have a mismatch parenthesis error

// Your line
if ($("input[type=file]").val().length !==0) || $("#book_map_keys").val().length !==0)
// The corrected line
if ($("input[type=file]").val().length !==0 || $("#book_map_keys").val().length !==0)

Upvotes: 5

Related Questions