Jquery-mobile-form-buttons
提供:Dev Guides
jQuery Mobile-フォームボタン
jQuery Mobileは、ニーズに応じてカスタマイズできるボタンスタイルをサポートしています。 <input> 要素は、フォームのボタンをコーディングするために使用されます。 以下は、ボタンのスタイルを変更するために使用される属性です。
Sr.No. | Attribute | Value | Description |
---|---|---|---|
1 | data-corners | true/false | Sets the corner for the buttons. |
2 | data-icon | Different icons | Sets different icon on the button. |
3 | data-iconpos | left/right/bottom/top/notext | Sets the position for the icon on the button. |
4 | data-inline | true/false | Sets the button inline. |
5 | data-mini | true/false | Sets the button small. |
6 | data-shadow | true/false | Sets the shadow for the button. |
例
次の例は、jQuery Mobileでフォームボタンを使用する方法を示しています。
<!DOCTYPE html>
<html>
<head>
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
<div data-role = "page">
<div data-role = "header">
<h2>Form Button</h2>
</div>
<div data-role = "main" class = "ui-content">
<form method = "post" action = "jquery_mobile/demo.php">
<label for = "fname">First Name</label>
<input type = "text" name = "fname">
<label for = "lname">Last Name</label>
<input type = "text" name = "lname">
<input type = "submit" value = "Submit Button" data-inline = "true"
data-corner = "true">
<input type = "reset" value = "Reset Button" data-inline = "true"
data-corner = "true">
</form>
</div>
</div>
</body>
</html>
出力
上記のコードがどのように機能するかを確認するために、次の手順を実行してみましょう-
- 上記のHTMLコードを form_buttonsl ファイルとしてサーバーのルートフォルダーに保存します。
- このHTMLファイルをhttp://localhost/form_buttonslとして開くと、次の出力が表示されます。