Yes that's right. But actually what I am doing is that, I have a one canvas element in the whiteboard, where I use to scriblle the pencil tool and what I want is to change the background of my canvas on click of some tool. I have done it with JS functions but issue with that is when I am creating multiple whiteboard sessions with the same whiteboard id generated by the server.
<script>
//functions for grid background change
function english() {
document.getElementById("myCanvas").style.backgroundImage = "url('../img/bg.png')";
}
function hindi() {
document.getElementById("myCanvas").style.backgroundImage = "url('../img/bg1.png')";
}
function math() {
document.getElementById("myCanvas").style.backgroundImage = "url('../img/bg2.png')";
}
function grid() {
document.getElementById("myCanvas").style.backgroundImage = "url('../img/bg3.png')";
}
//functions for background color change
function red() {
document.getElementById("myCanvas").style.backgroundColor = "red";
}
function green() {
document.getElementById("myCanvas").style.backgroundColor = "green";
}
function black() {
document.getElementById("myCanvas").style.backgroundColor = "black";
}
function yellow() {
document.getElementById("myCanvas").style.backgroundColor = "yellow";
}
</script>
<canvas whiteboard class="board" id="myCanvas" resize="true">
</canvas>