Sudeep's Blog

Disorganized Thoughts in Organized Manner

jQuery mobile on iOS: a.href vs a.data
I have been struggling with click event assignment to "a" tag on jQuery mobile on iPhone using Cordova. My exact problem was "href" attribute was returning nothing. There were a variety of solutions posted online, from attaching the callback to vclick or tap or touchStart event to storing that information somewhere else and retrieving it on "click" event. The solution was quite simple. jQuery mobile, for some reason, stores the "href" in the data attribute of the "a". Handling event in "click" callback and using a.data("href") did the trick for me.
Tweet
Back to Home