How to clear all
s’ contents inside a parent
?

前端 未结 14 1901
面向向阳花
面向向阳花 2020-12-07 10:10

I have a div

which has several child
s.

Example:

<
14条回答
  •  清歌不尽
    2020-12-07 10:41

    I know this is a jQuery related question, but I believe someone might get here expecting a pure Javascript solution. So, if you were trying to do this using js, you could use the innerHTML property and set it to an empty string.

    document.getElementById('masterdiv').innerHTML = '';
    

提交回复
热议问题