{"name":"submit","type":"selector","title":":submit Selector","deprecated":null,"removed":null,"desc":"Selects all elements of type submit.","categories":["selectors/form-selectors","selectors/jquery-selector-extensions","version/1.0"],"entries":[{"return":"","signatures":{"added":"1.0"},"examples":{"desc":"Finds all submit elements that are descendants of a td element.","code":"\nvar submitEl = $( \"td :submit\" )\n .parent( \"td\" )\n .css({\n background: \"yellow\",\n border: \"3px red solid\"\n })\n .end();\n\n$( \"#result\" ).text( \"jQuery matched \" + submitEl.length + \" elements.\" );\n\n// Prevent form submission\n$( \"form\" ).submit(function( event ) {\n event.preventDefault();\n});\n\n// Extra JS to make the HTML easier to edit (None of this is relevant to the ':submit' selector)\n$( \"#exampleTable\" ).find( \"td\" ).each(function( i, el ) {\n var inputEl = $( el ).children(),\n inputType = inputEl.attr( \"type\" ) ? \" type='\" + inputEl.attr( \"type\" ) + \"'\" : \"\" ;\n $( el ).before( \"\" + inputEl[ 0 ].nodeName + inputType + \"\" );\n})\n","css":"\n textarea {\n height: 45px;\n }\n ","html":"\n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n Element Type\n \n Element\n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n \n
\n
\n
\n"},"longdesc":"\n

The :submit selector typically applies to button or input elements. Note that some browsers treat <button> element as type=\"submit\" implicitly while others (such as Internet Explorer) do not. To ensure that markup works consistently across all browsers and guarantee that it is possible to consistently select buttons that will submit a form, always specify a type property.

\n "}],"slug":"submit-selector"}