Replacing some of the menu.js functions to contain less index shuffling

Change-Id: Id1a9dc10db2b9b0d0395f9b92eadc58783a12538
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index c139ba7..01bf7d8 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -616,17 +616,13 @@
     /**
      * Delete all visible items from the menu element
      */
-    removeItems : function () {
-      // Remove all children
-      const children = this._el.childNodes;
-
-      // Leave the prefix and lengthField
-      for (let i = children.length - 1; i >= 3; i--) {
-        this._el.removeChild(
-          children[i]
-        );
+    
+     removeItems : function () {
+      const liElements=this._el.getElementsByTagName("LI");
+      while (liElements.length>0){
+        this._el.removeChild(liElements[0]);
       };
-    },
+     },
 
 
     /**