Ya I got the result actually the listener for id demo was not doing anything and when i removed that it started working Thanks again
Ashish
@Ashish
Posts made by Ashish
-
RE: Not able to execute Jquery hide and show
-
Not able to execute Jquery hide and show
I am trying to hide and show p tag on two different button click but I am not able to get it .
Error I am getting :
"Uncaught TypeError: Cannot call method 'addEventListener' of null", source:file:///android_asset/www/js/index.js (48)
p1.html
<p id="hidep">If you click on the "Hide" button, I will disappear.</p> <button id="hide" onclick="hideButton()">Hide</button> <button id="show" onclick="hideButton()">Show</button>
index.js
function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } function onDeviceReady() { document.getElementById('demo').addEventListener("click", printMsg, false); document.getElementById('show').addEventListener("click", hideButton, false); document.getElementById('hide').addEventListener("click", hideButton, false); document.addEventListener("pause", onPause, false); document.addEventListener("resume", onResume, false); document.addEventListener("menubutton", onMenuKeyDown, false); } function hideButton(){ $("#hide").click(function(){ $("#hidep").hide(); }); $("#show").click(function(){ $("#hidep").show(); }); }
-
RE: Javascript not working in Cordova with Onsen
I just wanted to know why I am not able to use ons.notification.alert() whereas simple alert() is working properly
-
RE: Javascript not working in Cordova with Onsen
Got the Result , Finally I saw the Alert Box in my Emulator…Thanks for your suggestions @argelius and @munsterlander .
-
RE: Javascript not working in Cordova with Onsen
@argelius I have added the link for index.js file. You can view my project on the below link http://www.filedropper.com/onsenui_2
-
Javascript not working in Cordova with Onsen
I am trying to call a function in Javascript but its not working.
I didnt find any references on Onsen website and on Google as well.
Can any one tell me what are the Exact steps for calling a function in Javascript?
Do I need to define the function in index.js file or Can I write the function in the same file inside script tags?
I am using Onsen 2.
I had also asked a similar question regarding http://stackoverflow.com/questions/36932137/jquery-works-in-browser-but-not-in-an-android-emulator jquery but no solution yet.
p1.html
<body onload="onLoad()"> <ons-page> <ons-button id="demo" onclick="printMsg()">Click Me</ons-button> </ons-page>
index.js
function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } function onDeviceReady() { document.getElementById('demo').addEventListener("click", printMsg, false); document.getElementById('btnNext').addEventListener("click", callNextPage, false); document.addEventListener("pause", onPause, false); document.addEventListener("resume", onResume, false); document.addEventListener("menubutton", onMenuKeyDown, false); } function printMsg() { ons.notification.alert('Hello'): //alert('hello'); //document.addEventListener("deviceready", onDeviceReady, false); }
Output Error Msg:
“Uncaught ReferenceError: printMsg is not defined”, source: file:///android_asset/www/index.html
Edit :
I have Uploaded my Project at http://www.filedropper.com/onsenui_2