Button
优质
小牛编辑
122浏览
2023-12-01
描述 (Description)
Widget button功能可以与JqueryUI中的小部件一起使用.Button是类型提交和锚的输入。
语法 (Syntax)
这是使用Button的简单语法 -
$(function() {
$( "input[type = submit], a, button" )
.button()
.click(function( event ) {
event.preventDefault();
});
});
例子 (Example)
以下是显示Button用法的简单示例 -
<!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>