remove all
  • from
      ?
  • 后端 未结 7 1015
    北荒
    北荒 2020-12-15 02:48

    I am appending li in a ul using the following code:

    for (var i = 1; i <= len; i++) {
        li = document.createElement(\'li\');
    
              
    
    
            
    7条回答
    •  小蘑菇
      小蘑菇 (楼主)
      2020-12-15 03:35

      You appear to be trying this with raw JavaScript:

      while( root.firstChild ){
        root.removeChild( root.firstChild );
      }
      

      jQuery will only slow you down here.

    提交回复
    热议问题