呆呆鱼

js 控制表单提交

<form id="form2">
  <input type="text" name="text" value="">
  <input type="submit" name="" value="" id="liuyan">
</form>
 
例:

//留言验证

$("#liuyan").live("click",function(){

  if($("input[name='text']").val()==""){         

    alert("请填写姓名");         

    return false;    

  }else{      

    $("#form2").submit();    

  }         

});

posted on 2016-12-08 18:15  呆呆鱼  阅读(203)  评论(0编辑  收藏  举报

导航