jquery - Adding blank Data to an HTML Tag -
i wanting result adding data attribute through jquery.
<li class="uk-pearent" data-uk-dropdown="">
the code using
$('.uk-pearent').data('data-uk-dropdown');
this returns data attribute have not assigned yet; question is, how assign blank data attribute html tag using jquery.
thanks in advance
how assign blank data attribute html tag using jquery.
you can pass value of data attribute second argument of data()
$('.uk-pearent').data('uk-dropdown', '');
to value of data have remove data- before key
var uk-dropdown = $('.uk-pearent').data('uk-dropdown');'
syntax .data( key, value )
Comments
Post a Comment