canvas example

messing with canvas

HTML

<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<canvas id="canvas" width="200" height="200">           
 </canvas>

CSS

canvas {
    border: 1px dotted black;
    background: navy;
}

JavaScript

var $testButton = $('<input/>').attr({
    type: 'button',
    name: 'btn1',
    value: 'TestButton',
    id: 'testButton',
    style: 'position:absolute; top:50px;left:100px; zindex:2'
});
$('body').append($testButton);
$(document).on("click", "#testButton", function() {
    alert('button clicked');
});