2013年4月15日 星期一

Adding and Removing Nodes

For key methods to handle inserting nodes into elements:

.append()

.appendTo()

.prepend()

.prependTo()

image

image

.wrap() function to wrap the contents

image

.remove() to remove nodes from an element

image

 

Demo Example:

1. append() and prepend():

image

Output result:

image

 

2. appendTo() and prependTo():

image

Output result:

image

 

3. wrap():

image

image

Before vs. After

imageimage

 

4. remove():

image

Output result:

image

沒有留言:

張貼留言