:submit

返回值

Array<Element(s)>

概述

匹配所有提交按钮,理论上只匹配 type="submit" 的input或者button,但是现在的很多浏览器,button元素默认的type即为submit,所以很多情况下,不设置type的button也会成为筛选结果。为了防止歧义或者误操作,建议所有的button在使用时都添加type属性。

示例

描述: 查找所有提交按钮

HTML代码

<form>
  <input type="text" />
  <input type="checkbox" />
  <input type="radio" />
  <input type="image" />
  <input type="file" />
  <input type="submit" />
  <input type="reset" />
  <input type="password" />
  <input type="button" />
  <select><option/></select>
  <textarea></textarea>
  <button></button>
</form>

jQuery 代码

$(":submit")

结果


[ <input type="submit" />, <button></button> ]