Using .data to add data attribute using jQuery -


i have 2 spans on site:

<span class="view-toggle"></span>

and i'd firstly set data-status="inactive" (to clear of settings), , add data-status="active" 1 element.

i have following:

$('.view-toggle').find().data("status","inactive"); $(button).data( "status", "active"); 

i can confirm $(button) correctly identifies 1 span want add active to.

i'm not getting console errors, i'm not getting addition of data attributes.

am using data() incorrectly?

to value of attribute :

<strong id="the_id" data-original-title="i need this">  $('#the_id').data('original-title'); 

to set value of attribute

$('#div').attr(attname,attvalue); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -