JQuery

经过一段时间的前后端开发








总结:JQuery太强大了!

事件:
    //实时监听指定input值
    $("#brief").bind("input propertychange",function(){
        $("#num").html($("#brief").val().length + "/200")
    })

    //指定input键盘弹起事件
    $("#phoneNumber").keyup(function(){
        $("#account").val($("#phoneNumber").val());
    });

    //失去焦点事件
    $("#phoneNumber").blur(function(){
        $("#account").val($("#phoneNumber").val());
    });

    //多个元素绑定同一个事件
    $("#labourCompanyId ,#enterpriseId").change(function () {
        $("#jobId").children().remove();
    });
元素操作:
    
    //值设为空
    $("#payPeriod").val("");

    //隐藏
    $("#payPeriod").hide();

    //显示
    $("#payPeriod").show();

    //删除指定属性
    $("#payPeriod").removeAttr("lay-verify");

    //删除指定标签
    $('.imgDiv').remove();

    //找到指定标签下的某个元素
    let length = $("#rechargeImg").find(".imgDiv").length;

    //添加指定属性
    $("#howDayRelease").attr("lay-verify","required");
posted @ 2019-12-30 15:02  橙一万  阅读(77)  评论(0编辑  收藏  举报