Linked Questions

-1 votes
1 answer
785 views

I have this code (with jQuery 1.9.1): var Clon = $('#mylabel'); then I would change data-attributes, but is not established when I check the value: Clon.data('hello','1'); but this method return the ...
carlituxman's user avatar
  • 1,221
0 votes
2 answers
1k views

I have some data attributes set to equal nothing when the page loads. Once a user selects an item from a list item it then populates the data attributes. I want to perform a simple validation that ...
user8463989's user avatar
  • 2,479
4 votes
2 answers
646 views

strange problem - maybe I'm missing something. My code: HTML <div id="container"> <span data-foo="initial content">Blabla</span> </div> jQuery console.log($("span")....
David Müller's user avatar
1 vote
3 answers
79 views

Given the below code I expect both foo and bar to have a div inside of them with the appropriate data attribute, but only the one using attr works. Am I missing something? Is this possible? Can ...
Jazzepi's user avatar
  • 5,500
0 votes
0 answers
50 views

My problem is that I want to make reset/new game button to my simple memory game and it went well until the cards have to shuffle again. Now it only works to play same game over and over again. Here ...
Johanna's user avatar
733 votes
4 answers
814k views

I would like to know what selectors are available for these data attributes that come with HTML5. Taking this piece of HTML as an example: <ul data-group="Companies"> <li data-company="...
Jose3d's user avatar
  • 9,287
547 votes
3 answers
215k views

What is the difference in usage between $.data and $.attr when using data-someAttribute? My understanding is that $.data is stored within jQuery's $.cache, not the DOM. Therefore, if I want to use $....
John B's user avatar
  • 5,495
183 votes
9 answers
143k views

I need to select elements based on values stored in an element's .data() object. At a minimum, I'd like to select top-level data properties using selectors, perhaps like this: $('a').data("category","...
Tauren's user avatar
  • 27.3k
33 votes
3 answers
11k views

Here's a simple example to illustrate the behavior: Given this html markup: <div data-company="Microsoft"></div> and this jQuery code (using jQuery 1.5.1): // read the data alert($("div"...
James H's user avatar
  • 2,399
3 votes
1 answer
3k views

Could someone explain why this isn't working? What I'm trying to do is update a data attribute called 'section_id' in a dropped element with the new section it has been dropped into. I check this ...
Phil Freeman's user avatar
3 votes
1 answer
4k views

I'm using jQuery, I have a simple list <ul id="list"> <li data-kind="foo">Foo1</li> <li data-kind="foo">Foo2</li> <li data-kind="foo">Foo3</li> </ul>...
SDp's user avatar
  • 329
0 votes
2 answers
1k views

I want to update the value of data attribute. I checked showing alert message but when I inspect element the value is not updated. Here is my code: alert(pid); // show 1 alert($('#buybtn')....
Abdus Sattar Bhuiyan's user avatar
0 votes
2 answers
2k views

I have a list of items which will contain a tag using the data-type attribute. I'm attempting to loop through the items to grab each tag in an array. Where a list item has more than one tag (separated ...
Sheixt's user avatar
  • 2,626
2 votes
1 answer
980 views

I have this small code that put some preset style to a div with custom attributes, that attributes set the src and an APA text to an img tag, also generate a button with a zoom option using FancyBox......
user avatar
0 votes
1 answer
388 views

In first hover i am getting data id from thumbs and adding to #main image it is working fine and with 2nd hover on #main i am getting the data id again here from the first data id. but it is only ...
Amir Alam Khan's user avatar

15 30 50 per page