嗨,大家好,我正在尝试为我的博客文章创建一个“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