简体   繁体   English

Js在拨动开关上添加工具提示

[英]Js Add a tooltip on toggle switch

I want to add a tooltip on toggle switch which looks like this:我想在切换开关上添加一个工具提示,如下所示:

拨动开关

And here is the code:这是代码:

<div class="switch">
  <label>
    Off
    <input id="on-off" type="checkbox" checked>
    <span class="lever"></span> 
    On
  </label>
</div>

For example, when the mouse is over "On", I want to show the text "The tooltip is on" and over "Off", "The tooltip is off".例如,当鼠标悬停在“On”上时,我想显示文本“The tooltip is on”和“Off”,“The tooltip is off”。 Tried with different tutorials but not easy with toggle switch.尝试了不同的教程,但使用拨动开关并不容易。

I want to add a tooltip on toggle switch which looks like this:我想在切换开关上添加一个工具提示,如下所示:

拨动开关

And here is the code:这是代码:

<div class="switch">
  <label>
    Off
    <input id="on-off" type="checkbox" checked>
    <span class="lever"></span> 
    On
  </label>
</div>

For example, when the mouse is over "On", I want to show the text "The tooltip is on" and over "Off", "The tooltip is off".例如,当鼠标悬停在“On”上时,我想显示文本“The tooltip is on”和“Off”,“The tooltip is off”。 Tried with different tutorials but not easy with toggle switch.尝试了不同的教程,但使用拨动开关并不容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM