0
我想將我的代碼簡化爲一個完整的步驟函數。由於它具有相同的屬性&函數,我不知道在一個動作中完全合併它的調用函數。裸露在一起,我只是一個noob jQuery用戶。提前感謝您的建議。簡化jQuery DOM請求
$('a[data-user="add"]').click(function(event) {
event.preventDefault();
$('.list-unstyled li').removeClass('active');
$('section.col-lg-8').replaceWith(formAdd);
$('.form-custom').load('includes/pages/admin/admin-user-add.php');
subHash = this.hash;
});
$('a[data-user="settings"]').click(function(event) {
event.preventDefault();
$('.list-unstyled li').removeClass('active');
$('section.col-lg-8').replaceWith(formAdd);
$('.form-custom').load('includes/pages/admin/admin-user-settings.php');
subHash = this.hash;
});
我認爲包括它與兩個單獨的逗號,將是一個好主意,但它不是。它默認視圖爲我的第一次加載。
哪裏是你的HTML –
你的意思是這個劇本的整個代碼?或整個頁面? – iMarkDesigns