Get the App
SLTechnology News&Howtos  ›  Development  › 

The solution to the ineffectiveness of jquery data

Shulou Source: shulou.com Published: 2022-06-02 12:30:24 10月01日 Update

Editor to share with you the solution that jquery data does not work, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The solution that jquery data does not work: 1, open the corresponding code file; 2, use the "dom.attr ('data-hour')" statement, that is, the attr () method to get the attribute value.

This article operating environment: Windows7 system, jquery3.2.1, Dell G3 computer.

With regard to the .data () method of jQuery, it doesn't seem to work after reassignment

Recently I used jquery's data method to do a countdown, something like this:

01:00:00

1) at the beginning, we used the time stored in data, dom.data ()

2) re-assign data every other second, dom.attr ({'data-hour':hour,'data-minute':minute,'data-second':second})

3) pause

4) start again, repeat 1), and then notice that the countdown starts again from 1:00:00.

We don't know why, but we have changed it: 1) in the dom.attr ('data-hour'), attr () method to get the attribute value

If you know why, can you tell me? thank you.

The above is all the content of the article "the solution that jquery data doesn't work". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Methods functions articles countdown content attributes clear not so much that is code methods most files time more environment computers knowledge systems industries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Technology Docker Shulou Tech Info macOS