I want to add one cell in a section each time I click the add button. The page is updated without refreshing.
The html code is:
<section>
<p class="cell">content</p>
</section>
<button type="button" id="addCell">add</button>
How should I implement the js?Thanks!
Very simple, use
append()orafter(). In your caseappend()will work better.Unfortunately I can’t show you a demo because jsFiddle is under maintenance.
Demo in jsbin: http://jsbin.com/agosap/