90 of 119 menu

Reset selector

The selector :reset selects elements of type reset, which are form clear buttons. The equivalent of $(':reset') is $('[type=reset]'). Since :reset is not part of the CSS specification, for better performance in modern browsers it is better to use [type='reset'] instead.

Syntax

This is how we select elements with type reset:

$(':reset');

Example

Let's select all inputs with type reset and give them a green background and a red border using the css method:

<form> <input type="button" value="button"> <input type="file"> <input type="password"> <button>button</button> <input type="reset"> <input type="radio" name="test"> <input type="radio" name="test"> <input type="checkbox"> <input type="text"> </form> <+javascript+> $('input:reset').css({background: 'green', border: '2px red solid'}); $('form').submit(function(event) { event.preventDefault(); // prevents form submission }); <-javascript->

See also

  • selector button,
    which selects button elements and all elements with type button
  • method filter,
    which filters elements in a set by a given selector
  • method find,
    which searches for elements within those already found
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline