嗨,大家好,我正在嘗試爲我的博客文章創建一個「zen視圖」模式,所以我只想抓取#single div的內容(僅文章內容沒有標題或siderbar等),並把它放到另一個名爲#禪 - 視圖的div,請注意,我使用WordPress。抓取div的內容並插入另一個div
所以我儘量讓這個代碼現在:
<button class="zen">Read in Zen mode</button> // when clicked display #zen-view div
<div id="zen-view"> // initialy the css of that div is set to display:none
<p id="zen-content"></p> // the tag where the contet of the #single div will be load
<button class="close" href="#">Close Zen mode</button> // when clicked close zen-view div
</div>
,這裏是jQuery的
$(function() {
$('.zen').click(function() {
$('#zen-view').show();
... how can i grab the content of #single div and put into #zen-content div? ...
});
$('.close').click(function() {
$('#zen-view').hide();
});
});
感謝
與您的問題無關,但您爲什麼使用類('zen'和'close')來完成ID的工作? – nnnnnn