2014-08-27 45 views
0

由於某些原因,.addClass方法不會將該類添加到剛通過AJAX調用通過$(div).prepend方法添加到頁面的內容中。我首先從所有的內容中刪除了粗體格式,然後想要讓新的粗體格式變爲粗體。這是jQuery的特質還是我錯過了什麼?下面的代碼:Jquery .addClass問題

function sess(id,tid) { 
$.ajax ({ 
    method:  "POST", 
    url:  'sess.php', 
    data:  {"fid":id}, 
    success: function(response) { 
        $('.create').show(); 
        //docs(id); //previously isolated - not the problem 
        //mess(id,tid); //previously isolated - not the problem 
        //msf(); //previously isolated - not the problem 
        //suppf(); //previously isolated - not the problem 
        //filesf(); //previously isolated - not the problem 
        $('.f').removeClass('bold'); 
        $('#f-'+id).addClass('bold'); 
        $('#supp-'+id).show(); 
       } 
});  

}

+0

AJAX調用返回什麼內容? – 2014-08-27 17:35:53

+0

你是在談論粗體字體,還是一個名爲bold – Kingpin2k 2014-08-27 17:38:23

+0

的類,內容是從前一個函數返回的。該函數返回當前文件列表的內容(添加文件的信息),然後調用此函數以使新文件處於活動狀態 – user988129 2014-08-27 17:38:59

回答

0

想通了 - 我被忘記的內容parseInt函數()從先前的函數返回的,所以我經過時,JS正在尋找一個整數的字符串。

我不好。感謝大家。