简体   繁体   English

如何记住单击按钮的时间

[英]How to remember when button is clicked

I have read about using localStorage, and can't seem to get it to work and never really understand how it really works.我已经阅读了有关使用 localStorage 的信息,但似乎无法让它工作,也从未真正了解它是如何工作的。 If someone can help me with this it would be much appreciated.如果有人可以帮助我,将不胜感激。

<link rel="stylesheet" href="darkmodestyle.css" id="darkmodestyle" disabled="disabled">

. .

$(document).ready(function (){

 $(".darkmode-toggle").click(function () {                


     if ($("#darkmodestyle").prop("disabled")) {
        
        $('#darkmodestyle').removeAttr("disabled");

     } 
     else {
        $('#darkmodestyle').attr("disabled", "disabled");
     }
   });
});

I have read about using localStorage, and can't seem to get it to work and never really understand how it really works.我已经阅读了有关使用 localStorage 的信息,但似乎无法让它工作,也从未真正了解它是如何工作的。 If someone can help me with this it would be much appreciated.如果有人可以帮助我,将不胜感激。

<link rel="stylesheet" href="darkmodestyle.css" id="darkmodestyle" disabled="disabled">

. .

$(document).ready(function (){

 $(".darkmode-toggle").click(function () {                


     if ($("#darkmodestyle").prop("disabled")) {
        
        $('#darkmodestyle').removeAttr("disabled");

     } 
     else {
        $('#darkmodestyle').attr("disabled", "disabled");
     }
   });
});

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

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