components
components copied to clipboard
unable to use JS code inside index.js from page
For example, In index page I have included all the JS and CSS files, pages will be in separate HTML files. I have a page named Home.html, and I have a button. In JS I have $('.plus-btn').on('click', function(e) { alert("Hi"); });
The alert is not being fired. If I mention a function to call from button onClick(), this is being called.
I tested by placing the JS code inside .ready() and document.addEventListener("deviceready", function(){ });
Still not working.
Is there any code I'm missing. Help would be appreciated.
This is because web itself does not allow js to execute inside the same page. Try have an external js file and linking it to the html document.