I am attempting to add a data attribute to an element on document.ready in order to set a default loading status.
I currently have:
jQuery(document).ready(function($) {
$('#menu-primary-navigation li.isMobile').data('status','closed');
)};
I was expecting to see the following HTML
<li class="isMobile" data-status="closed" >foo</li>
However I don't seem to see any data attribute added. Am I using .data()
incorrectly?