我有以下代碼。帶有類「.acc_container」的html元素是通過AJAX調用動態創建的,所以在執行代碼$('.acc_container').hide();
時它們不存在。有什麼我可以在這裏做類似於事件綁定的.live
函數嗎?jQuery - 如何顯示/隱藏動態生成的html元素
$(document).ready(function() {
$('.acc_container').hide();
$.ajax({
type: 'GET',
url: 'Sample.xml',
dataType: 'xml',
success: function (xml) {
//Tags with ".acc_container" class created here
爲什麼不把它隱藏在成功回調函數中? –
好主意John。我認爲這也會起作用。謝謝。 – Laguna