buttonclick = CustomJS(args=dict(div=div, sl=slider, b1=button1), code="""
if (cb_obj.label == '► Play'){
div.text = cb_obj.label;
alert(cb_obj.label);
cb_obj.label = '❚❚ Pause';
cb_obj.change.emit();
}
else{
cb_obj.label = '► Play';
div.text = cb_obj.label;
alert(cb_obj.label);
cb_obj.change.emit();
}
/*
function update() {
div.text = sl.value.toString();
if (sl.value < sl.end){
sl.value = sl.value+sl.step;
sl.change.emit();
}
else{
clearInterval(sh)
}
}
var sh;
sh = setInterval(update, 1000);
*/
""")
button = Button(label='► Play', button_type="primary")
button.js_on_click(buttonclick)
Q1:Hello, in the simple code above, I get cb_obj.label undefined, not ‘► Play’ ? How can I change the label of the button in its ‘callback’ function?
Q2:By the way, In the reference of Button, I find js_on_change (event , *callbacks ) and js_on_click (handler ). What is the difference between callback and handler? Does the cb_obj in callback support accessing the property of itself but not in handler?

