Home>

Modify the value of a switch

.mui-switch:before {
  font-size:13px;
  position:absolute;
  top:3px;
  right:11px;
  content:attr (data-off);
  text-transform:uppercase;
  color:#999;
  }
  .mui-switch.mui-active:before {
  right:auto;
  left:15px;
  content:attr (data-on);
  color:#fff;
  }
<div>
<ul>
<li>
<span>Alarm Message Settings</span>
<div data-off="off" data-on="On">
<div></div>
</div>
</li>
</ul>
</div>

Control switch status:

document.getelementbyid ("myswitch"). addeventlistener ("toggle", function (event) {
if (event.detail.isactive) {
  var btnarray=["Cancel", "Confirm"];
mui.confirm ("After turning off the alarm push message,The system will no longer push alarm messages?"," Warning! ", Btnarray, function (e) {
if (e.index == 1) {
console.log ("You turned off alarm push");
} else {
mui ("#myswitch"). switch (). toggle ();
}
}, "div")
} else {
}
})
  • Previous CentOS65 installation python37 detailed steps
  • Next vue routing tutorial for static routing