form表单有条件提交

发布时间:2018-11-29编辑:佚名阅读(1176)

页面代码:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
<div>
    <form action="a.html" method="post">
        <input type="text" id="text" />
        <input type="button" value="提交查询" id="btn"/>
    </form>
</div>
</body>

加个onclick事件判断下

$(function(){
    $("#btn").click(function(){
        var t=$("#text").val().length;
        if(t<=10){
            alert("长度不够!!");
            return false;
        }
    });
});


  关键字:form表单有条件提交


鼓掌

0

正能量

0

0

呵呵

0


评论区