jQuery UI Spinner禁用选项
jQuery UI由GUI部件,视觉效果和使用jQuery,CSS和HTML实现的主题组成。jQuery UI对于构建网页的UI界面非常有用。在这篇文章中,我们将看到如何使用jQuery UI滑块中的禁用选项。禁用选项是用来禁用jQuery UI spinner的。默认情况下,该值为false。
语法:
$( ".selector" ).spinner(
{ disabled: boolean}
);
参数:该选项接受一个上面提到的和下面描述的单一参数。
- boolean。这个参数持有真和假的值。
CDN链接:首先,添加jQuery UI脚本的CDN链接,为你的任务所需。
<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:在这个例子中,我们将设置禁用选项为true。它将使旋转器失效。
<!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({ disabled: true });
});
</script>
</head>
<body>
<h1>GeeksforGeeks</h1>
<h2>jQuery UI | spinner disabled Option</h2>
<div id="geeks">
<input type="text" id="gfg" value="12" />
</div>
</body>
</html>
输出: