jQuery :button Selector

By: Bipin C Mathew 9 months, 1 week ago

The Button selector selects all button elements and input elements when type = "button". We can select all buttons of the web page with button selector It does not select input elements of type submit. it is not part of the CSS specification and it's a jQuery extention.

Syntax   $(":button")


<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>button demo</title>
textarea {
   height: 35px;
div {
   color: red;
fieldset {
   margin: 0;
   padding: 0;
   border-width: 0;
.marked {
   background-color: yellow;
   border: 3px red solid;
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>

    Button: <input type="button" value="Input Button"> <br> <br>

    Submit: <input type="submit"> <br> <br>
    TextBox: <input type="text"> <br> <br>

    Button: <button>Button</button> <br><br>


var input = $( ":button" ).addClass( "marked" );
$( "div" ).text( "Button found = " + input.length + "." );
// Prevent the form from submitting
$( "form" ).submit(function( event ) {



Let us talk!

We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.