def toggle_err_callback():
    """JS callback for Error toggle Toggle button

    Returns
    -------
    code : :obj:`str`
    """
    code = """
            let n_glyphs = ax.length;
             //if toggle button active
            if (cb_obj.active.includes(0))
                {
                    for(let i=0; i<n_glyphs; i++){
                        //only switch on if corresponding plot is on
                        if(ax[i].visible){
                            ax_err[i].visible = true;
                        }

                    }
                }
            else{
                    for(let i=0; i<n_glyphs; i++){
                        ax_err[i].visible = false;
                    }
                }
            """
    return code
