jquery - Javascript: Show .div if two inputs have a value of x or y -
i have 2 inputs , div
. able show div
when both of inputs have value of 6 or 7.
i'm new javascript. close i've been able come (which isn't, fear, close):
var div = $('div').hide(); $('.first, .second').keyup(function() { var value = this.value; if (value == 6 || value == 7) { div.fadein(); } else { div.fadeout(); } });
$('.first, .second').keyup(function() { var value1 = $(".first").val(); var value2 = $(".second").val(); if ((value1 == 6 || value1 == 7) && (value2 == 6 || value2 == 7)) { div.fadein(); } else { div.fadeout(); } });
try above
Comments
Post a Comment