Skip to main content

Bug Tracker

Side navigation

#13623 closed bug (duplicate)

Opened March 19, 2013 07:33AM UTC

Closed March 19, 2013 12:40PM UTC

Last modified June 22, 2014 10:56PM UTC does not work when using an attribute selector

Reported by: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 2.0b2
Keywords: Cc:
Blocked by: Blocking:

It's my understanding that .data should get/set "data-" attributes.

However, after using .data("foo", "value") to set a particular attribute on an element, that element is not selectable using a "[data-foo=value]" selector. Using .attr instead works as expected.


I'm pretty sure this exists downlevel as well.

Attachments (0)
Change History (3)

Changed March 19, 2013 12:40PM UTC by rwaldron comment:1

resolution: → duplicate
status: newclosed

Duplicate of #13234.

Changed June 22, 2014 02:09PM UTC by Timwi comment:2

This bug is not a duplicate of #13234.

The jsfiddle provided in the bugreport clearly demonstrates the problem. I created a different one that exposes the same bug:

Please reopen this bug.

Changed June 22, 2014 10:56PM UTC by dmethvin comment:3

As documented, the jQuery .data() API does not set data- attributes.

The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). --