我的autocomplete和datetimepicker脚本发生冲突。因此,日期选择器不起作用。我尝试noConflict()方法,但它不适合我。我必须使用这两个脚本代码。
我的脚本代码
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
$("#projeadi").autocomplete("projeler.php", {
selectFirst: true
});
});
</script>
<script src="jquery-ui.js"></script>
<script src="jquery-ui.min.js"></script>
<link rel="stylesheet" href="jquery-ui.css">
<link rel="stylesheet" href="jquery-ui.min.css">
<link rel="stylesheet" href="jquery-ui.structure.css">
<link rel="stylesheet" href="jquery-ui.structure.min.css">
<link rel="stylesheet" href="jquery-ui.theme.css">
<link rel="stylesheet" href="jquery-ui.theme.min.css">
<script>
$(function() {
$( "#datepicker" ).datepicker({dateFormat: "yy-mm-dd"});
$.datepicker.regional['tr'] = {
closeText: 'kapat',
prevText: '<geri',
nextText: 'ileri>',
currentText: 'bugün',
monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
'Temmuz','Ağustos','Eylül','Ekim','Kasım','Aralık'],
monthNamesShort: ['Oca','Şub','Mar','Nis','May','Haz',
'Tem','Ağu','Eyl','Eki','Kas','Ara'],
dayNames: ['Pazar','Pazartesi','Salı','Çarşamba','Perşembe','Cuma','Cumartesi'],
dayNamesShort: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
dayNamesMin: ['Pz','Pt','Sa','Ça','Pe','Cu','Ct'],
weekHeader: 'Hf',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['tr']);
});
</script>
<script>
$(function() {
$( "#datepicker2" ).datepicker({dateFormat: "yy-mm-dd"});
});
</script>
我如何解决这个问题。抱歉我的英语不好。
答案 0 :(得分:0)
好的,我解决了我的问题。我编辑了jquery.js和autocomplete.js,我在这些jquery.js和autocomplete.js中将“$”更改为“jQuery”。在这些之后,我将脚本代码更改为
<script>
var $cakisma = jQuery.noConflict();
$cakisma(document).ready(function(){
$cakisma("#projeadi").autocomplete("projeler.php", {
selectFirst: true
});
});
</script>
它就像一个魅力。感谢大家的帮助。