gpt4 book ai didi

javascript - 两个脚本之间的jquery冲突

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:59:22 25 4
gpt4 key购买 nike

我在使用的 2 个 jqueries 之间有冲突问题,我已经检查了 jQuery.noConflict() 东西但是因为我是一个新手所以我不知道如何处理它,所以如果你能帮助我,那就太好了。

似乎“jquery-2.1.4.min.js”让“jquery-ui-1.8rc1.custom.min.js”停止工作,所以没有收到弹出窗口,没有任何反应。

提前致谢。

代码:

<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>

最佳答案

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

由于您使用的是更新版本的 jQuery,因此可能存在兼容性问题。

您是否可能在控制台中收到任何警告或错误?也许与deprecated functions有关.

关于javascript - 两个脚本之间的jquery冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30662615/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com