Morgan Ng Morgan Ng - 2 months ago 8
Javascript Question

text input value greater 10 not more than 5000 jQUERY

I am creating an html set the input text which value must be more than 10 and below 5000. Indeed my code seems not working , Kindly advise .

jQUERY :

$(document).ready(function() {
$(".zijin_input").keyup(function() {
if ((this).value() > 10) {
$(".zijin_button").css("display", "block");
$(".zijin_button_span").css("display","none");
$('.cunkuan_line_2').addClass('cunkuan_line_3').removeClass('cunkuan_line_2');
// $("#lineBAR").addClass('cunkuan_line_3');
}
else {
$(".zijin_button").css("display", "none");
$(".zijin_button_span").css("display","block");
$('.cunkuan_line_3').addClass('cunkuan_line_2').removeClass('cunkuan_line_3');
}
});
});

Answer
$(document).ready(function() {
        $(".zijin_input").keyup(function() {
            if ($(this).val() > 10  && $(this).val()<5000) {
                $(".zijin_button").css("display", "block");
                $(".zijin_button_span").css("display","none");
                $('.cunkuan_line_2').addClass('cunkuan_line_3').removeClass('cunkuan_line_2');
                // $("#lineBAR").addClass('cunkuan_line_3'); 
            }
            else {
                $(".zijin_button").css("display", "none");
                $(".zijin_button_span").css("display","block");
                $('.cunkuan_line_3').addClass('cunkuan_line_2').removeClass('cunkuan_line_3');
            }
        });
    });
Comments