Your setColor
function is defined in closure of anonymous function that you provided as argument to Zepto
and is invisible in global scope. From the other hand setColor
that you are calling as onclick
handler should be defined in global scope (which is window
). In order to make your setColor
function accessible from anywhere you should define it in the namespace of window
:
JavaScript
Zepto(function($){
var colorL;
window.setColor = function setColor(col)
{
colorL = context.strokeStyle = col;
}
});