189
rated 0 times
[
195]
[
6]
/ answers: 1 / hits: 20975
/ 8 Years ago, sun, april 24, 2016, 12:00:00
I try to create button which starts an alert after a click event. Something like that :
<body>
<div class=app>
<h1>Apache Cordova</h1>
<div id=deviceready class=blink>
<p class=event listening>Connecting to Device</p>
<p class=event received>Device is Ready</p>
</div>
<button onclick=alert('salut') id=boutonAlerte>Alerte</button>
</div>
<script type=text/javascript src=cordova.js></script>
<script type=text/javascript src=js/index.js></script> </body>
but the problem is that my onclick doesn't work. A lot of people tell me to try it on javascript so I've decided to write something like that :
function onAlertClick() {
alert(ceci est une alerte);
}
alert(test2);
var bA = document.getElementById(boutonAlerte);
bA.addEventListener(onclick, onAlertClick());
But this is the same thing.
Any ideas ?
More From » android