Is it to control the display of elements on the page or to directly add elements dynamically? -PHP Chinese website Q&A-To control the display of elements on the page, do you control the element display or directly add elements dynamically? -PHP Chinese website Q&A
Is it to control the display of elements on the page or to directly add elements dynamically? -PHP Chinese website Q&A-To control the display of elements on the page, do you control the element display or directly add elements dynamically? -PHP Chinese website Q&A
Let’s take a look and learn.
首先这两种处理方法应该是应对两种需求时使用的,
一. 按题主说的display:
能够复用的一个元素(同一个).
这时显示/隐藏比较好.
显示/隐藏方式:
$().show/hide
dom.style.display
class
二. 动态添加:
同一模板多次使用.比如一个列表, 动态添加item.