JS image preview problem, resulting in the subsequent function does not execute the problem?

the following is the JS local preview image used by the code snippet
, which is uploaded and loaded into the pre-written DIV, and then the pop-up prompt of the subsequent function quickly overwrites
and even the pop-up prompt of other functions cannot be used after the image is loaded. I have been confused for a long time to find a solution.

function PreviewImage(divImage, upload) {
    if (checkPic()) {
        try {
            //console.log(upload.files[0]);
            var imgPath = getObjectURL(upload.files[0]);
            // $(".divImage").css("background","url(imgPath)")
            document.getElementById(divImage).innerHTML = "<img id="imgPreview" class="bgimg1" src="" + imgPath + "" width="" + "100%" + "" height="" + "100%" + ""/>";
            $(".menu").hide();
            $(".menuswitch1").removeClass("menuswitch1").addClass("menuswitch");
            var appElement = document.querySelector("[ng-controller=screenCtrl]");
            var $scope = angular.element(appElement).scope();
            $(".success_text").html("");
            $scope.$apply(function () {
                $scope.success_display = false;
            })
            setTimeout(function () {
                $scope.$apply(function () {
                    $scope.success_display = true;
                })
            }, 2000);
        } catch (e) {
            alert("");
        }
    }
}
Mar.04,2021

change the part of jQ, it hurts when you look at the string. The part of the Angular hasn't moved.

  use the $(function) method < / div > ";} 
),

wrap our function with $(). And you can bind multiple functions on a page. If you use traditional window.onload, you can only call one function.

so please use this method to call the function that modifies DOM. Also pay attention to the difference between document.createElement and innerHTML. If possible, try to create objects in the form of document.createElement and $("< div/ >").

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaaa3b-47dc8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaaa3b-47dc8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?