0
在我的iPhone的webapp,我有一個空白的div和我動態 使用添加的東西出來:iPhone Web應用程序設計
var example=$(document.createElement('which-ever-tag i need'));
example.html('blah blah')
blank_div.append(example);
這樣我就可以添加和我需要刪除元素。
example.remove();
最近我想,雖然,我也能做到這樣從我最初的HTML頁面:
<div id='homepage'>
place some content in here
</div>
<div id='second_page'>
some more content
</div>
,然後我可以隱藏和取消隱藏某些章節。我只是想知道什麼是最好的方法來做到這一點?
JavaScript來動態創建元素,或者讓它們製作並且只需顯示一個需要的部分就可以取消隱藏?
代碼片段:
title=$(document.createElement('div'));
title.addClass('title');
title.html('Mango Fitness');
container.append(title);