This is a migrated thread and some comments may be shown as answers.

jquery .change() not listening to toggle flip-switch state change

5 Answers 860 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alfredo
Top achievements
Rank 2
Alfredo asked on 28 Jul 2013, 07:16 PM
Hello,

Ported a jQuery Mobile App from another platform and all of a sudden flip switches aren't being read. No change detected. Already tried with .change(), .bind(), .on() and no luck. Flip switches still work ok in other platform and as a web App but not in Icenium.

Your help will be appreciated.

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 29 Jul 2013, 07:20 AM
Hello Alfredo,

We were able to successfully trigger the switch and it is correctly indicated with the following code:

<script>
    $('#flip_2').on('change', function() {
        alert($('#flip_2').val());
    });
</script>

You can see our observations in the following short video.

Regards,
Steve
Telerik

Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Alfredo
Top achievements
Rank 2
answered on 29 Jul 2013, 01:31 PM
Thank you Steve for the reply. This is very strange!. Commented the code on the control.js file, and placed your code in the <head> area and no, no luck. Somehow events are being blocked! This time tried on Mist with same results.

Let me do a test-on-device and come back to you. Ok?
0
Alfredo
Top achievements
Rank 2
answered on 06 Aug 2013, 06:13 AM
Steve,

I'm sorry for insisting on this trivial issue, but something strange is happening here. My javascript  isn't able to modify DOM elements at all. Either with plain-vanilla JavaScript or jQuery no matter what I try just can't, for example, set an input field value or read a flip-switch state change.

True is in your video thigs are Ok but somehow on my machine and inside Graphite things are different. This is very weird. Can you check on my code as it's now please?

You may want to check this short video I made: Video

Thank you!

P.D. Also tried with checkboxes but nothing seems to work!
0
Steve
Telerik team
answered on 08 Aug 2013, 01:20 PM
Hello Alfredo,

We do not see how this could be caused by Icenium IDE as what you're doing is a generic javascript intervention. As shown in previous video, the flip-switch operation works on our end with your project. So naturally we have the following questions/suggestions:
  • If the problem was Graphite related, then Mist would work, you already stated that is not the case. If that has changed you can go to %localappdata%\Telerik\BlackDragon\<your_email_here> and delete your project from the folder (that is if you do not have anything to commit to the project). Then Pull from the repository and see if everything is fine.
  • try the same javascript code in a vanilla project - does it work? Consider moving your app files to the new project and identifying the culprit as effect of this. You can also export your project and import it as zip archive (easier, but the problem could still be there and you're not ahead in identifying the issue).
  • isolate the problem in a sample jsbin.com i.e. does this work at all in regular browser.

Regards,
Steve
Telerik

Do you enjoy Icenium? Vote for it as your favorite new product here (use short code H048S).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Alfredo
Top achievements
Rank 2
answered on 08 Aug 2013, 01:44 PM
Steve,

Thanks for the reply!. As said before this is very strange since even disabling an <input> field wasn't working (with jQuery). The App is coming from another mobile development platform with everything working Ok. However we are a little short in time and found a workaround by replacing the flip-switches with checkboxes.

We are definitely going to dive in to  this as we would like to use the switch instead in future releases and because we're porting the rest of our Apps to the Icenium platform.

Thank you!
Tags
General Discussion
Asked by
Alfredo
Top achievements
Rank 2
Answers by
Steve
Telerik team
Alfredo
Top achievements
Rank 2
Share this question
or