What is the difference between after() and before() in jquery? -PHP Chinese website Q&A-What is the difference between after() and before() in jquery? -PHP Chinese website Q&A
Please watch and learn.
一个是向后,一个是向前,可以在程序里自己尝试下,就容易明白了
after向元素的后边添加html代码,如果元素后面有元素了,那将后面的元素后移,然后将html代码插入
before向元素的前边添加html代码,如果元素前面有元素了,那将前面的元素前移,然后将html代码插入
What is the difference between after() and before() in jquery? -PHP Chinese website Q&A-What is the difference between after() and before() in jquery? -PHP Chinese website Q&A
Please watch and learn.
一个是向后,一个是向前,可以在程序里自己尝试下,就容易明白了
after向元素的后边添加html代码,如果元素后面有元素了,那将后面的元素后移,然后将html代码插入
before向元素的前边添加html代码,如果元素前面有元素了,那将前面的元素前移,然后将html代码插入