文字输入值大于10不超过5000 jQUERY

时间:2016-09-30 10:31:23

标签: javascript jquery

我正在创建一个html设置输入文本,其值必须大于10且小于5000.确实我的代码似乎不起作用,请建议。

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');
            }
        });
    });

4 个答案:

答案 0 :(得分:0)

应该像

$(document).ready(function() {
    $(".zijin_input").keyup(function() {
        if ($(this).val() > 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');
        }
    });
});

答案 1 :(得分:0)

$(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');
            }
        });
    });

答案 2 :(得分:0)

试试这个

   $(".zijin_input").keyup(function() {
        if ( parseInt($(this).val()) > 10  && parseInt($(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');
        }
    });

点击此链接https://jsfiddle.net/5jhk4yzu/

答案 3 :(得分:0)

    DELIMITER $$

CREATE DEFINER=`testmysql`@`%` PROCEDURE `PDADeviceAssign`(

IN DeviceID varchar(50),
IN EmpID varchar(50),
IN PlazaID varchar(50),
IN LaneID varchar(50),
IN AssignDateTime varchar(50),
IN AssignTranID varchar(50),
IN AssignedBy varchar(50),
IN Start_at varchar(50),
IN End_at varchar(50),
IN IsNextDay varchar(50),
IN ClientID varchar(50),
IN Description varchar(50)
)
BEGIN

    declare Sno int; 

    set Sno=(SELECT MAX(Sno) FROM posassignment WHERE DeviceID=DeviceID);    
    update posassignment set LiveStatus ='N' where Sno=Sno;

Insert into posassignment(DeviceID,EmpId,PlazaID,LaneID,AssignDateTime,AssignTranID,AssignedBy,LiveStatus,Start_at,End_at,IsNextDay,ClientId,Description)
   values (DeviceID,EmpID,PlazaID,LaneID,AssignDateTime,AssignTranID,AssignedBy,'Y',Start_at,End_at,IsNextDay,ClientId,Description); 
END