简体   繁体   中英

How to see jquery's data() with developer tools?

I am assigning data to elements with data() function .

How to see it in Chrome development tools to debug correctness?

I don't see any data-* attributes appearing?


I can see assosiated data with Watch if I have element object. But can I see if some data assisiated with any element in Elements ?

See the documentation for the function you are using :

Using the data() method to update data does not affect attributes in the DOM. To set a data-* attribute value, use attr.

If you want to read the value, you need to read it with data() too. jQuery won't directly associate it with the element. The only connection is in jQuery's internal store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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