Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery.data() works in Mac OS WebKit, but not on iPhone OS?
    text
    copied!<p>I'm playing around with jQTouch for an iPhone OS app that I've been toying with off and on for a while. I wanted to try my hand building it as a web app so I started playing with jQTouch. For reference, here is the page+source (all my code is currently in <code>index.html</code> so you can just "View Source" to see it all):</p> <p><a href="http://rpj.me/doughapp.com/wd/" rel="nofollow noreferrer">http://rpj.me/doughapp.com/wd/</a></p> <p>Essentially, I'm trying to save pertinent JSON objects retrieved from Google Local into DOM objects using the data() method (in this example, <code>obj</code> is the Google Local object):</p> <pre><code>$('#locPane').data('selected', obj); </code></pre> <p>then later (in a different "pane"), retrieving that object to be used:</p> <pre><code>$('#locPane').bind('pageAnimationEnd', function(e, inf) { var selobj = $(this).data('selected'); // use 'selobj' here ... } </code></pre> <p>In Chromium and Safari on the desktop OS (Snow Leopard in my case), this works perfectly (try it out).</p> <p>However, the same code returns <code>undefined</code> for the call to <code>$(this).data('selected')</code> in the second snippet above. I've also tried <code>$('#' + e.target.id).data('selected')</code> and even the naive <code>$('#locPane').data('selected')</code>. All variants return <code>undefined</code> in the iPhone OS version of WebKit, but not on the desktop.</p> <p>Interestingly, the running this on Mobile Safari in the iPhone Simulator <strong>fails as well</strong>.</p> <p>If you look at the full source, you'll see that I even try to save this object into my global jQTouch object (named <code>jqt</code> in my code). This, too, fails on the mobile platform.</p> <p>Has anyone else ever ran into this? I'll admit to not being a web/javascript programmer by trade, so if I'm making an idiot's error please call me out on it.</p> <p>Thank you in advance for the help! -RPJ</p> <p><strong>Update:</strong> I didn't make it clear in the original post, but I'm open to any workaround if it works consistently. Since I'm having trouble storing these objects in general, anything that allows me to keep them around is good enough for now. Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload