Jquery-widget-button

提供:Dev Guides
移動先:案内検索

jQuery-ウィジェットボタン

説明

*Widget button* 関数は、JqueryUIのウィジェットで使用できます。Buttonは、タイプsubmitおよびアンカーの入力です。

構文

以下は、ボタンを使用する簡単な構文です-

$(function() {
   $( "input[type = submit], a, button" )
   .button()
   .click(function( event ) {
      event.preventDefault();
   });
});

以下は、ボタンの使用方法を示す簡単な例です-

<!doctype html>
<html lang = "en">
   <head>
      <meta charset = "utf-8">
      <title>jQuery UI Button - Default functionality</title>

      <link rel = "stylesheet"
         href = "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">

      <script src = "//code.jquery.com/jquery-1.10.2.js">
      </script>
      <script src = "//code.jquery.com/ui/1.11.4/jquery-ui.js">
      </script>

      <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>
   </body>
</html>

これにより、次の結果が生成されます–