:button Selector - Javascript jQuery Selector

Javascript examples for jQuery Selector:button

Description

The :button selector selects button elements, and input elements with type=button.

The following code shows how to select <button> elements and <input> elements with type="button":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $(":button").hide();
    });//  w w  w .j a  va  2  s  .  c om
});
</script>
</head>
<body>

<input type="button" value="Another button"><br>
<h2>This is a heading</h2>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

<button>Click me</button>

</body>
</html>

Related Tutorials