I have a div where dynamic data attributes are added to some tags. (the name of the data attributes that will be generated dynamically using the script, so my script will not know the NAME attribute of the data attribute)
<div data-1223="some data" data-209329="some data" data-dog="some value"> </div>
Now I want to write code in which it resets the div, removing all data attributes and their values.
I can use
$('div').attr('data-209329',"")
but the problem is that I do not know the name of the data attribute to be added. the data attribute to be added is dynamic and I do not control it.
deleting a div and re-nesting a div is not an option. Help Pls. thanks in advance
source
share