:submitS2C Home « Selectors « :submit

Form submit selector.

Shorthand version $(':submit')

Description

The :submit selector, selects all elements of type submit.

Being a jQuery extension the :submit pseudo selector is not part of any current CSS specification. Therefore :submit cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method.

If this selector is not preceded by another selector, the universal selector ("*") is implied and so the whole DOM will be searched. Use another selector as in the example below to narrow the search and improve performance.

Syntax


Signature Description
jQuery(':submit')Form submit pseudo-class match

Parameters

None.

Return

N/A.

:submit Examplego to top of page Top

Selects all elements of type submit.

In the example below we apply an orange background to 'submit' elements within the form.


$(function(){
  $('.ourform').submit(function () { return false; }); // disable submit 
  $('#btn9').on('click', function() {
    $('form button:submit').css('backgroundColor', 'orange');
  });
});

Pie Survey     

Userame:      

Password:               

     

Which pie do you prefer?:

Select a pie shape: 

            


Press the button below to action the above code:


go to home page Homepage go to top of page Top