Page 1 of 2

Javascript not running... but only on exported app?

Posted: Wed Oct 02, 2013 10:45 pm
by Nathanael

So... I'm experiencing an interesting issue. A click event does not seem to be running on my exported app. However, when tested online, it works fine!

code
<pre>
if(Appery("notifications")&#46;find("input[type='checkbox']")&#46;attr("checked"))
{
&#47;&#47; UNCHECKED
alert('OFF');
}
else
{
&#47;&#47; CHECKED
alert('ON');
}

/code

This code is really straightforward, right? Once the checkbox is tapped... if it was checked, alert that it no longer is. Otherwise... yay! It's now checked! This works fine when testing online, but on my exported app, nothing happens at all.

Any idea why this might be? That's the entire JavaScript fragment. I didn't leave anything out. Where should I be looking for the error? Everything else on the page seems to be working, including other JavaScript click events.

Is there something about the code above that only works on a normal browser, for some reason?


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 12:19 am
by Igor

Hello,

Could you clarify please, on what component do you use "click" event? (button, mobilecheckbox, mobilecheckboxgroup).


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 4:26 pm
by Nathanael

mobilecheckbox


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 4:27 pm
by Nathanael

Also, that pre tag is not part of the actual JavaScript, obviously.


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 6:41 pm
by Nathanael

More information: the JavaScript definitely works. When I use "swipeleft", everything is fine. However, so far, "click", "virtual click", and "tap" have no effect.


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 6:43 pm
by Maryna Brodina

Hello! Thank you! Working on it.


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 6:46 pm
by Nathanael

Is it a glitch with Appery.io, not a misunderstanding on my part?


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 7:20 pm
by Maryna Brodina

Try the following code:
preif (Appery("notifications")&#46;find("input[type='checkbox']")&#46;prop("checked")) {
&#47;&#47; CHECKED
alert('ON');
} else {
&#47;&#47; UNCHECKED
alert('OFF');
}/pre


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 7:32 pm
by Nathanael

Hey Marina. I just tested it. While it works online as well, it does not work on the app.

The issue appears to be in certain events, such as "click". If I use "swipeleft", "taphold", or some others... the event fires no problem. However, with "click", "tap", and "virtual click", the event never fires. I suspect it has something to do with how the check box responds to those events, but I have absolutely no idea why, nor how to work around it.

Any ideas?


Javascript not running... but only on exported app?

Posted: Thu Oct 03, 2013 8:02 pm
by Maryna Brodina

Please try to use value change event instead click.