如何更改烤面包机的背景颜色和图像?

问题描述

我想将背景颜色和图像更改为else条件(toaster.error)

       success: function (data) {
                        if (data.message != ""){
                            toastr.success(data.message);
                        }
                        else {
                            toastr.error(data.message1);
                        }
                    }

我正在使用的这段代码我需要帮助

解决方法

您需要使用DOM访问该元素,也许像这样:

success: function (data) {
        if (data.message != ""){
            toastr.success(data.message);
            yourElementToChangeColor.classList.add('class-with-the-color')
        }else {
            toastr.error(data.message1);
        }
    }