Calling a function when using <button> tag with jQuery Mobile
- by u2sonderzug
I already asked a similar question for buttons in tags, but I find that solution doesn't work using tags. So, if I am using a script that references jQuery Mobile I have the following line:
<button id="buttonAnswer1" data-inline="true">Click me</button>
How would I add a listener for when this button is clicked and lets say call the hello() function? i.e.
<button id="buttonAnswer1" data-inline="true">Click me</button>
<script>
function hello(){
console.log("hello world");
}
</script>