jQuery API | jQuery API 中英文对照版 |
submit(fn) |
submit(fn)
在每一个匹配元素的submit事件中绑定一个处理函数。 返回值:jQuery 参数:
示例: 如果输入框中没有输入文本,阻止表单提交。 $("#myform").submit( function() { return $("input", this).val().length > 0; } ); HTML 代码: <form id="myform"><input /></form> submit(fn)Bind a function to the submit event of each matched element. Return value: jQuery
Example: Prevents the form submission when the input has no value
entered. $("#myform").submit( function() { return $("input", this).val().length > 0; } );Before: <form id="myform"><input /></form> |