this.user3272243
this.user3272243

Reputation: 1236

jquery conflict between two scripts

I have a conflict problem between 2 jqueries that I use, I've checked the jQuery.noConflict() thingy but since I'm a bit of a rookie into it i don't know what to do with it, so if you can give me a hand that'd be great.

It seems that "jquery-2.1.4.min.js" makes "jquery-ui-1.8rc1.custom.min.js" to stop working, so instead of receiving the pop-up windows nothing happens.

Thanks in advance.

The code:

<script src="/myjs/js/jquery-ui-1.8rc1.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">


    $(document).ready(function () {

        var mensaje = "<%= mensaje%>";
        var $dialogDel = $('<div></div>')
        .html(mensaje)
        .dialog({
            autoOpen: false,
            title: 'Alert',
            buttons: { "Ok": function() { $(this).dialog("close"); } }  
        });
        if(mensaje != ""){
            $dialogDel.dialog('open');
        }
    }); 

    function add(){

        var archivo = document.adddoc.add_archivo.value;

        extensiones_permitidas = new Array(".htm", ".html", ".txt", ".doc",".xls",".zip",".pdf",".jpg",".rar",".docx",".xlsx"); 


        extension = (archivo.substring(archivo.lastIndexOf("."))).toLowerCase(); 

        permitida = false; 
        for (var i = 0; i < extensiones_permitidas.length; i++) { 
           if (extensiones_permitidas[i] == extension) { 
           permitida = true; 
           break; 
           } 
        } 
        if (!permitida) { 
            alert("The extension is not correct");
        }else{
            var $dialog = $('<div></div>')
            .html('Doc beeing uploaded, please wait.')
            .dialog({
                autoOpen: false,
                title: 'Alert'
            });
            $dialog.dialog('open');
            $('#adddoc').submit();
        }

    }

</script>

    <script  type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
    <script src="/myjs/js/jquery.ezdz.min.js"></script>
   <script>

        $('[type="file"]').ezdz({
            text: 'drop a file',
            validators: {
                maxWidth:  100,
                maxHeight: 200
            }/* ,
            reject: function(file, errors) {
                if (errors.mimeType) {
                    alert(file.name + ' must be an image.');
                }

                if (errors.maxWidth) {
                    alert(file.name + ' must be width:600px max.');
                }

                if (errors.maxHeight) {
                    alert(file.name + ' must be height:400px max.');
                }
            } */
        });
    </script> 

Upvotes: 4

Views: 606

Answers (1)

Hermien
Hermien

Reputation: 184

jquery-ui-1.8rc1 is shipped with jquery-1.4.1.js.

Since you are using a way newer version of jQuery, it could be compatibility problems.

Do you perhaps get any warnings or errors in the console? Perhaps it has something to do with deprecated functions.

Upvotes: 3

Related Questions