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

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -