Inconsistent :jqmData selector when using $.fn.jqmData() #4948

slusarz opened this Issue Sep 6, 2012 · 4 comments


None yet

4 participants


Data set via $.fn.jqmData() is not accessible via the :jqmData selector.

Example HTML:

<div id="base">
  <div id="element1" data-foo="1"></div>
  <div id="element2"></div>

Example JS code:

// [ div#element1 ] - correct behavior

// Set data-foo to 1 on the second element also
$('#element2').jqmData('foo', 1);

// [ div#element1 ] - incorrect behavior; I would expect this to return [ div#element1, div#element2 ]

The return from this selector should not be dependent on whether someone manually entered the data in an HTML attribute. At a minimum, this is not documented. At worst, this is undesirable behavior.

It would seem the easiest way to fix would be to add the HTML attribute automatically within $.fn.jqmData().


+1 to this


I also find this annoying, is a simple reproduction of the error, which in my case is worked around by using a loop. Any comments on this? I'm using jQuery 1.9.1 and jQm 1.3.2

jQuery Foundation member

please see issue #6695 we will no longer have jqmData in any form after 1.5

jQuery Foundation member

also the selector is for selecting elements that have data attributes and use jqm name spacing the jqmData function is for setting and getting data on elements not data-attributes. please see documentation for .data this is just a namespaced version closing this as not a bug

@arschmitz arschmitz closed this Nov 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment