jquery 两个脚本之间的冲突
jquery conflict between two scripts
我使用的 2 个 jquery 之间存在冲突问题,我已经检查了 jQuery.noConflict() 东西但是因为我是一个新手所以我不知道该怎么做有了它,所以如果你能帮助我,那就太好了。
似乎 "jquery-2.1.4.min.js" 让 "jquery-ui-1.8rc1.custom.min.js" 停止工作,所以没有收到弹出窗口 windows 什么也没发生。
提前致谢。
代码:
<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.
有关
我使用的 2 个 jquery 之间存在冲突问题,我已经检查了 jQuery.noConflict() 东西但是因为我是一个新手所以我不知道该怎么做有了它,所以如果你能帮助我,那就太好了。
似乎 "jquery-2.1.4.min.js" 让 "jquery-ui-1.8rc1.custom.min.js" 停止工作,所以没有收到弹出窗口 windows 什么也没发生。
提前致谢。
代码:
<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.
有关