Data attribute value updated by jquery is not visible in DOM

后端 未结 2 1338
死守一世寂寞
死守一世寂寞 2020-11-30 07:28

I am updating a data attribute by jQuery, Like:

jQuery(\'div\').data(\'hidden\', \'true\');
alert(jQuery(\'div\').data(\'hidden\'));

Data a

2条回答
  •  既然无缘
    2020-11-30 08:30

    When you use .data() to update a data value, it is updating internal object managed by jQuery, so it will not be updated in the data-* attribute

提交回复
热议问题