我使用jquery-1.12.4创建了一个tabs函数,该tabs成功执行,但是$(...)中始终存在错误。 datepickers不是函数,有时也是$(...)。制表符不是功能。我真的很困惑,错误总是导致这些功能之一。如何解决?
$(document).ready(function(){
$('select[name="farea_id"]').change(function(){
var url = window.location.href;
url = url.substring(0, (url.indexOf("index.php") == -1) ? url.length : url.indexOf("index.php"));
var sendto = url+"index.php/ajax/get_i_fprovince/" + jQuery(this).val();
$("#i_fprovince").load(encodeURI(sendto));
});
$('#i_fprovince').change(function(){
var url = window.location.href;
url = url.substring(0, (url.indexOf("index.php") == -1) ? url.length : url.indexOf("index.php"));
var sendto = url+"index.php/ajax/get_i_fcity_id/" + jQuery('select[name="fprovince_id"]').val();
$("#i_fcity").load(encodeURI(sendto));
});
$('select[name="region"]').change(function(){
var url = window.location.href;
url = url.substring(0, (url.indexOf("index.php") == -1) ? url.length : url.indexOf("index.php"));
var sendto = url+"index.php/ajax/get_region/" + jQuery(this).val();
$("#i_region_parent").load(encodeURI(sendto));
});
$('select[name="cust_id"]').change(function(){
var url = window.location.href;
url = url.substring(0, (url.indexOf("index.php") == -1) ? url.length : url.indexOf("index.php"));
var sendto = url+"index.php/ajax/get_i_initial_cust/" + jQuery(this).val();
$("#fproject_initial").load(encodeURI(sendto));
});
$('.delete').click(function(){
var answer = confirm('Are you sure to delete "'+jQuery(this).attr('title')+'" ?');
return answer;
});
$( function() {
$( ".datepicker" ).datepicker({dateFormat: 'dd/mm/yy'});
$( ".datepicker" ).datepicker( "option", "dateFormat", "dd/mm/yy" );
$( ".datepicker" ).datepicker( "option", "altFormat", "dd/mm/yy" );
$( ".datepicker" ).datepicker( "option", "showButtonPanel", true );
$( ".datepicker" ).datepicker( "option", "currentText", "Today" );
$( ".datepicker" ).datepicker( "option", "showOn", "both" );
$( "#tasktab" ).tabs({
beforeLoad: function( event, ui ) {
ui.jqXHR.fail(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible."
);
});
}
});
$( "#oprtab" ).tabs({
beforeLoad: function( event, ui ) {
ui.jqXHR.fail(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible."
);
});
}
});
} );
$(".addintab").click(function() {
$("#tasktab_content").load(encodeURI(jQuery(this).attr('href')));
return false;
});
$(".cancelintab").click(function() {
var sendto = jQuery(this).attr('sendto');
var subm = jQuery(this).attr('subm');
$("#tasktab_content").load(encodeURI(sendto));
return false;
});
$('.deleteintab').click(function(){
var answer = confirm('Are you sure to delete "'+jQuery(this).attr('title')+'" ?');
if(answer) $("#tasktab_content").load(encodeURI(jQuery(this).attr('href')));
return false;
});
});