javascript - how to enable search btn when all 3 inputs have value? -
i have first, lastly inputs , country select, have disabled search btn default, how enable search btn when 3 inputs have value in them otherwise, disable search btn? have tried utilize "and" in js, "&&", didn't work. help appreciated.
[jsfiddle][1]
[1]: http://jsfiddle.net/x9syr1v1/3/
see http://jsfiddle.net/x9syr1v1/4/
use alter function otherwise you'll have tyo foucs out of drop downwards , utilize text() inputs:
$('.first, .last, .country').change(function () { if ($('.first').text() == "" && $('.last').text() == "" && $('.country').val() == "") { $('.search').attr('disabled','disabled'); } else { $('.search').removeattr('disabled'); } }); javascript jquery if-statement enable-if
No comments:
Post a Comment