有两种禁用表单元素的方法。
禁用类:禁用类可以应用于HTML的任何元素。
【Framework7表单禁用元素】禁用属性:禁用属性只能应用于输入, 文本区域和选择之类的表单元素。
注意:“禁用”元素的不透明度较低, 并且不会收到任何触摸/点击事件。例
让我们以一个示例来演示禁用的类和禁用的属性。
<
!DOCTYPE html>
<
html>
<
head>
<
meta name = "viewport" content = "width = device-width, initial-scale = 1, maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />
<
meta name = "apple-mobile-web-app-capable" content = "yes" />
<
meta name = "apple-mobile-web-app-status-bar-style" content = "black" />
<
title>
Checkboxes group<
/title>
<
link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.min.css" />
<
link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.colors.min.css" />
<
/head>
<
body>
<
div class = "views">
<
div class = "view view-main">
<
div class = "pages">
<
div data-page = "home" class = "page navbar-fixed">
<
div class = "navbar">
<
div class = "navbar-inner">
<
div class = "left">
<
/div>
<
div class = "center">
Disabled elements<
/div>
<
div class = "right">
<
/div>
<
/div>
<
/div>
<
div class = "page-content">
<
div class = "list-block">
<
ul>
<
li class = "item-content">
<
div class = "item-inner">
<
div class = "item-title">
Field 1<
/div>
<
/div>
<
/li>
<
!-- This element will be disabled -->
<
li class = "item-content disabled">
<
div class = "item-inner">
<
div class = "item-title">
Field 2 with <
strong>
disabled<
/strong>
class applied<
/div>
<
/div>
<
/li>
<
li class = "item-content">
<
div class = "item-inner">
<
div class = "item-title">
Field 3<
/div>
<
/div>
<
/li>
<
li class = "item-content">
<
div class = "item-inner">
<
div class = "item-title label">
This is input text<
/div>
<
div class = "item-input">
<
!-- Disabled input -->
<
input type = "text" name = "name" placeholder = "Enter your name">
<
/div>
<
/div>
<
/li>
<
!-- Element with disabled input -->
<
li class = "item-content">
<
div class = "item-inner">
<
div class = "item-title label">
This is <
strong>
disabled<
/strong>
input text<
/div>
<
div class = "item-input">
<
!-- Disabled input -->
<
input type = "text" name = "name" placeholder = "Enter your name" disabled>
<
/div>
<
/div>
<
/li>
<
/ul>
<
/div>
<
/div>
<
/div>
<
/div>
<
/div>
<
/div>
<
script type = "text/javascript" src = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/js/framework7.min.js">
<
/script>
<
script>
var myApp = new Framework7();
<
/script>
<
/body>
<
/html>
立即测试
推荐阅读
- Framework7表单数据
- Framework7复选框和单选按钮
- Framework7表单
- Ajax表单提交
- Framework7浮动操作按钮
- Framework7按钮
- Framework7 chip布局
- Framework7卡片
- Framework7列表视图