0
我有一個側欄,其中有一個鏈接到帳戶頁面。現在點擊該側邊欄中的帳戶,關於JavaScript沒有執行,如果我重新加載頁面,它正在正確執行。我無法理解這種行爲。誰能幫我理解這個問題頁面加載點擊鏈接,不起作用
$(document).on("ready page:load",function(){
makeProfile();
});
function makeProfile(){
$('#profile-form').hide();
$('.profile-edit').on("click",function(e){
// if they click on edit, show the form, other wise show the divs
if($('.profile-edit').text() == "Edit"){
$('.profile-edit').text("Save");
$('.profile-details').hide();
$('#profile-form').show();
}else{
$('.submit-hidden').click();
}
});
}
我們可以看到,它試圖與工作中的HTML?如果你切換到'$(document).ready(function(){ makeProfile(); });' 這樣你就可以使用jQuerys文檔而不是'on'監聽器。 – dj10dj100
實際上,如果我們重新加載頁面,那意味着就緒在那個時候執行正常。但問題是與渦輪鏈接 – gates