Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution to the ineffectiveness of jquery data

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report