[問題] jQuery Tabs 使用innerhtml改變div問題
請教一下大家,為什麼我用innerhtml替換tabs頁籤後
假設tabs3有3個頁籤~ tabs3-2&tabs3-3無法點選
自己真的太淺了~ 拜託大家
有查以前tabs的文章, 3131篇Unifish大大有說過幾個問題~(這裡因需求 我不能重整網頁)
所以我有測了一些作法,但還是無法正常運作,以下是問題描述...
---------------------問題描述Start-----------------------
web中使用了jQuery Tabs頁籤
<div id="father">
<div id="tabs">
|
tabs 1 2 3的初始頁籤
|
</div>
</div>
因為專案需求~ 所以可能點了某個連結後,會替換father裡的內容
所以我採用了
Loadtabs="<div id=\"tabs3\">"+
|
tabs3-1 ~3-n的頁籤內容(應該是沒有bug)
|
"</div>"
document.getElementById('father').innerHTML = Loadtabs;
此時發現如果很早就宣告
$( "#tabs" ).tabs();
$( "#tabs2" ).tabs();
$( "#tabs3" ).tabs();
頁籤的切換頁Link會像這樣
.tabs3-1
.tabs3-2
.tabs3-3
Content
所以我將$( "#tabs3" ).tabs(); 放在innerhtml後面~
但這樣子雖然頁籤的樣子CSS出來了
但是切換tabs3-2 & 3-3會無法改變內容,並跑出
jQuery jquery-1.8.2.js 477行驚嘆號
error: function( msg ) { throw new Error( msg ); },
------------------------問題結束---------------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.210.231.212
※ 編輯: sin282 來自: 218.210.231.212 (12/22 14:36)
※ 編輯: sin282 來自: 218.210.231.212 (12/22 15:09)
→
12/22 15:49, , 1F
12/22 15:49, 1F
→
12/22 16:06, , 2F
12/22 16:06, 2F
→
12/22 16:10, , 3F
12/22 16:10, 3F
推
12/22 16:28, , 4F
12/22 16:28, 4F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章