Build jQuery UI Button - Default functionality in JavaScript

Description

The following code shows how to build jQuery UI Button - Default functionality.

Example


<!-- Revised from demo code on http://jqueryui.com/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Default functionality</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<!--from   w ww .j  ava  2 s.  c  o m-->
<script>
$(function() {
$( "input[type=submit], a, button" )
.button()
.click(function( event ) {
event.preventDefault();
});
});
</script>
</head>
<body>

<button>A button element</button>

<input type="submit" value="A submit button">

<a href="#">An anchor</a>

<div class="demo-description">
<p>Examples of the markup that can be used for buttons: A button element, an input of type submit and an anchor.</p>
</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Build jQuery UI Button - Default functionality in JavaScript
Home »
  Javascript Tutorial »
    jQuery UI »
      Button
Javascript Tutorial Button
Build jQuery UI Button - Checkboxes in Java...
Build jQuery UI Button - Default functional...
Build jQuery UI Button - Icons in JavaScrip...
Build jQuery UI Button - Radios in JavaScri...
Build jQuery UI Button - Split button in Ja...
Build jQuery UI Button - Toolbar in JavaScr...