The following code won't load the green rectangle in the canvas. This is my very first time trying out jQuery (either it sucks or me sucks), why such a simple thing is not working, I'm baffled. My web browser is Firefox 3.6. Playing with jQuery because there's another jQuery-driven piece of code that could be quite useful...
<html>
<head>
<style type="text/css">
#canvas {
border:1px solid black;
}
</style>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"/>
<script type="text/javascript">
// have also tried
<script type="application/javascript">
$(function() {
var canvas = $("#canvas")[0];
var ctx = canvas.getContext("2d");
// ctx.clearRect(0,0,300,300);
ctx.fillStyle = "green";
ctx.fillRect(0,0,50,50);
});
</script>
</head>
<body>
<canvas id="canvas" width="300" height="300"></canvas>
</body>
</html>