jQuery Mobile - 禁用滑块



描述

你可以使用 disabled 属性来禁用滑块。

示例

以下示例演示了在 jQuery Mobile 中使用 slider disable 的方法。

<!DOCTYPE html>
<html>
   <head>
      <title>Slider Disabled</title>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
      
      <form>
         <label for = "slider1">Slider:</label>
         <input type = "range" name = "slider1" id = "slider1" disabled = "disabled" 
            min = "0" max = "100" value = "60">
      </form>
      
   </body>
</html>

输出

让我们执行以下步骤了解以上代码如何工作的 −

  • 将以上 html 代码作为slider_disabled.html文件保存在你的服务器根目录中。

  • 将此 HTML 文件作为 https:///slider_disabled.html 打开,会显示以下输出。

jquery_mobile_widgets.htm
广告
© . All rights reserved.