framework7

Open full view…

onclick prompt not firing

itasia
Wed, 18 Jun 2014 06:11:36 GMT

in my HTML : <input type="button" value="Update" class="skyBigButton updateEmail" /> in my-ap.js : $$('.updateEmail').on('click', function () { myApp.prompt('What is your email ?', function (value) { myApp.alert('Thanks'); }); }); When I click the button, the prompt doesn't show. No Javascript error. I took it directly from the documentation, so it should work....

itasia
Wed, 18 Jun 2014 06:15:10 GMT

if I do the old way, it works.: HTML <input type="button" value="Update" class="skyBigButton updateEmail" onclick="updateEmailClick()" /> in my-ap.js : function updateEmailClick() { myApp.prompt('Please indicate your email', function (value) { myApp.alert('Your email was updated : "' + value + '".'); }); } quite dirty. I would prefer to put a click listener on the button.....

Vladimir Kharlampidi
Wed, 18 Jun 2014 16:37:40 GMT

I guess you problem could be because your button is not on home page? Use your custom event handler within pageInit event for appropriate page

itasia
Tue, 24 Jun 2014 16:43:06 GMT

do you have an example ? Thanks Vladimir for all your answers :)

Vladimir Kharlampidi
Tue, 24 Jun 2014 16:48:39 GMT

There are a lot of such examples in docs how to use scripts for specific pages (look at least in Get Started section :) Or you can just use live event: --- $$(document).on('click', '.updateEmail', function () { myApp.prompt('What is your email ?', function (value) { myApp.alert('Thanks'); }); });

seme1
Tue, 24 Jun 2014 17:38:50 GMT

Good. Thanks again :)