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

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -