jQuery – :button Selector

The jQuery button selector selects all button elements and elements of type button. jQuery(‘:button’) is equivalent to jQuery(‘[type=button]’)

Source Code

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  
<button>Click Here</button>

  
<script>
jQuery("button").click(function () {
	jQuery(':button').css("border","5px solid #1E8CBE");
});
</script>
</body>
</html>

Demo

Following example finds all button inputs and create a border around them.

,

No comments yet.

Leave a Reply