Write JS sometimes you can run, sometimes you can't?

encounter a complex problem

I am the front end and I am currently working with the back end

js I have no problem testing on my own machine

but as soon as the backend is moved to our backend

the js and jquery I wrote about a lot of problems sometimes run and sometimes they don"t

it"s very strange that some js don"t even run at all

my guess is that the background environment is too complex (at least 10 years old system, and a lot of jquery suites are installed), which makes it easy to conflict

.

I would like to ask if there is any solution to this situation

in addition, I find that if I use a href= "https://www.dropzonejs.com/-sharpinstallation)" rel=" nofollow noreferrer "> https://www.dropzonejs.com/-sharpi., I can be very stable and must be able to run

.

but the js you wrote won"t move? ?

I don"t know what the problem is

mainly because this section of js will not run

$(".form-img-wrap").on("change", ".upload", function() {
    var _this = this;
    $.filePreview.create(this, {
        isReader: false,
        progress: function(key, percent) {
            console.log(percent)
        },
        success: function(key, obj) {
            var $img = $(_this).parents(".form-img-wrap").find(".img").eq(key);
            $img.css({
                "background-image": "url(" + obj.preview + ")"
            });
        }
    });
});

Jul.06,2021

closures, independent namespaces, do not use global variables. Nothing else can be guessed


try:

$('.form-img-wrap').bind('input propertychange', '.upload', function() {
    ....
});
Menu