Q:

Call javascript in a button

How to call a javascript in a html button. Button is not working EDITED
Please take a look at jsfiddle : http://jsfiddle.net/winresh24/Sq7hg/341/
<button onclick="myFunction()">Try it

function myFunction{

html2canvas([document.getElementById('mydiv')], {

    onrendered: function (canvas) {

        var data = canvas.toDataURL('image/png');

        var image = new Image();
        image.src = data;
        document.getElementById('image').appendChild(image);

}
});

}

A:

You can use onlick="javascript:alert('do something here')" on a button.
Full code will look like this:
<button onlick="javascript:alert('do something here')">Click Me!</button>

At the time of answering, you did not have any function, but as Jason suggested, you should do that.
you can also use onclick="myFunction()";
I've edited your jsfiddle. Its working now.
Check it out at http://jsfiddle.net/Sq7hg/345/
Also, You'll need to define the function before you call it.
Mark my answer as answer If I helped you ;)

