jQuery UI Spinner最大选项
在jQuery UI滑块中的max选项。max选项是用来设置jQuery UI旋转器中的最大值。默认情况下,该值为空。
语法:
$( ".selector" ).spinner(
{ max: number | 'string' }
);
CDN链接:首先,添加jQuery UI脚本的CDN链接,为你的任务所需。
参数:该选项接受上面提到的和下面描述的两个参数。
- number。该参数持有最大值的数字。
- string:该参数将根据numberFormat和culture选项进行解析,否则将退回到本地parseFloat()方法。
<link href = “https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css” rel = “stylesheet”>
<script src = “https://code.jquery.com/jquery-1.10.2.js”></script>
<script src = “https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
例子1:在这个例子中,我们将使用旋转器的最大选项为50。
<!doctype html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<link href =
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
rel = "stylesheet" />
<script src =
"https://code.jquery.com/jquery-1.10.2.js">
</script>
<script src =
"https://code.jquery.com/ui/1.10.4/jquery-ui.js">
</script>
<script>
(function() {
( "#gfg" ).spinner(
{max: 50}
);
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner max option</h2>
<div id = "geeks">
<input type = "text" id = "gfg" value = "45" />
</div>
</body>
</html>
输出: