按回车不提交,表单验证,验证之后提交

<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
    $('form').submit(function () {
         return false;
    });
    $(document).keyup(function(event){
        if (event.keyCode == 13){
            if (true) {//逻辑判断
                document.forms[0].submit();
            }
        }
    });
})
</script>
<form id='myform'>
<input type="text">
<input type="submit">
</form>