Hey all I am trying to find all data attributes and replace the name with a number count.
The example HTML is this:
<li class="ui-menu-item" role="presentation" data-name="0">
<a id="ui-id-2" class="ui-corner-all" tabindex="-1">AScript</a>
</li>
<li class="ui-menu-item" role="presentation" data-name="0">
<a id="ui-id-2" class="ui-corner-all" tabindex="-1">Something</a>
</li>
etc etc...
There are about 20 or so with that same data-name attribute. I am wanting to loop through the page, finding that attribute, and then replacing that number and adding the correct number to it.
As an example:
<li class="ui-menu-item" role="presentation" data-name="0">
<a id="ui-id-2" class="ui-corner-all" tabindex="-1">AScript</a>
</li>
<li class="ui-menu-item" role="presentation" data-name="1">
<a id="ui-id-2" class="ui-corner-all" tabindex="-1">Something</a>
</li>
<li class="ui-menu-item" role="presentation" data-name="2">
<a id="ui-id-2" class="ui-corner-all" tabindex="-1">Hey there</a>
</li>
etc etc...
Notice how data-name is 0, 1, 2, etc etc.
That is what i am looking to do. Is that possible using jQuery?