Reputation: 28513
I'm a little lost...
I need my Jquery Mobile page to have an id, but set the data-url to file path. By default JQM takes the filepath as data-url, but if an id is supplied, the data-url will be overwritten with the id, which I don't want.
So:
<div id="some" data-role="page"></div>
Will result in:
<div id="some" data-role="page" data-url="some"></div>
While I need it to be:
<div id="some" data-role="page" data-url="/path/to/this/file.html"></div>
I'm trying to manually set the data-url, but it does not work like this:
$('div:jqmData(role="page")')
.jqmData('url', $.mobile.path.parseUrl( window.location.href ).pathname )
Question:
What am I doing wrong?
Upvotes: 0
Views: 2170
Reputation: 28513
Ok. Seems this only works like this:
$('div:jqmData(role="page")').attr({'data-url': $.mobile.path.parseUrl( window.location.href ).pathname});
Upvotes: 1