Nathanael
Posts: 0
Joined: Tue Dec 11, 2012 11:25 pm

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

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?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

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

Hello,

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

Nathanael
Posts: 0
Joined: Tue Dec 11, 2012 11:25 pm

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

mobilecheckbox

Nathanael
Posts: 0
Joined: Tue Dec 11, 2012 11:25 pm

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

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

Nathanael
Posts: 0
Joined: Tue Dec 11, 2012 11:25 pm

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

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

Hello! Thank you! Working on it.

Nathanael
Posts: 0
Joined: Tue Dec 11, 2012 11:25 pm

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

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

Nathanael
Posts: 0
Joined: Tue Dec 11, 2012 11:25 pm

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

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?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

Please try to use value change event instead click.

Return to “Issues”