Calling a function when using <button> tag with jQuery Mobile
        Posted  
        
            by 
                u2sonderzug
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by u2sonderzug
        
        
        
        Published on 2012-12-10T05:02:13Z
        Indexed on 
            2012/12/10
            5:03 UTC
        
        
        Read the original article
        Hit count: 174
        
jQuery
|jquery-mobile
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>
© Stack Overflow or respective owner