The jQuery :button selector selects button elements and input elements with type="button". The button element is not selected if we use input=" button" as a selector.Â
Syntax:
$(":button")
Example 1:Â In this example, we are using jQuery: button Selector.
<html>
<head>
<title>jQuery :button Selectortitle>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
script>
<script>
$(document).ready(function () {
$(":button").css(
"background-color", "lightgreen");
});
script>
head>
<body>
<center>
<form action="">
Name:
<input type="text" name="user">
<br><br> Password:
<input type="password" name="password">
<br><br>
<button type="button">
Button
button>
<br><br>
<input type="reset" value="Reset">
<input type="submit" value="Submit">
<br>
form>
center>
body>
html>
Output:Â

Â
Example 2:Â In this example, we are using jQuery: button Selector.
<html>
<head>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js">
script>
<script>
$(function () {
$(":button").css(
"border", "10px dashed green");
});
script>
head>
<body>
<input type="button" value="Test" />
<br><br>
<input id="txtName" type="text" />
<input type="submit" value="Test" />
<br><br>
<button id="button1">
This is a button
button>
<br>
body>
html>
Output:
Â