Top "Custom-data-attribute" questions

Custom data attributes are intended to store custom data private to the page or application, for which there are no more appropriate attributes or elements.

How to get the data-id attribute?

I'm using the jQuery quicksand plugin. I need to get the data-id of the clicked item and pass it to …

javascript html jquery custom-data-attribute
jQuery how to find an element based on a data-attribute value?

I've got the following scenario: var el = 'li'; and there are 5 <li>'s on the page each with …

jquery jquery-selectors custom-data-attribute
Selecting element by data attribute

Is there an easy and straight-forward method to select elements based on their data attribute? For example, select all anchors …

jquery html custom-data-attribute
jQuery selectors on custom data attributes using HTML5

I would like to know what selectors are available for these data attributes that come with HTML5. Taking this piece …

javascript jquery jquery-selectors custom-data-attribute
How to set data attributes in HTML elements

I have a div with an attribute data-myval = "10". I want to update its value; wouldn't it change if I use …

jquery html custom-data-attribute
Select elements by attribute in CSS

Is it possible to select elements in CSS by their HTML5 data attributes (for example, data-role)?

css html css-selectors custom-data-attribute
jQuery find element by data attribute value

I have a few elements like below: <a class="slide-link" href="#" data-slide="0">1</a> <a class="…

jquery html css custom-data-attribute
Adding data attribute to DOM

$('div').data('info', 1); alert($('div').data('info')); //this works $('div[data-info="1"]').text('222'); //but this don't work I'm …

jquery html custom-data-attribute
get data attributes in JavaScript code

I have next html: <span data-typeId="123" data-type="topic" data-points="-1" data-important="true" id="the-span"></span> Is …

javascript html custom-data-attribute
jQuery Data vs Attr?

What is the difference in usage between $.data and $.attr when using data-someAttribute? My understanding is that $.data is stored …

javascript jquery html custom-data-attribute