I use this example that allow me to draw into the canvas. http://devfiles.myopera.com/articles/649/example2.html
However, I want to have a button that clears the content of it. This is what I did without luck.
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#clearme").click(function() {
var view = $('#imageView');
var context = view[0].getContext('2d');
context.clearRect(550, 550, view.width(), view.height());
});
});
<a href="#" id="clearme">clear</a>
<div id="container">
<canvas id="imageView" width="610" height="680">
</canvas>
</div>
What am I missing here?
Clear the canvas via its API instead: