removing elements from html with javascript

12 hours ago 2
ARTICLE AD BOX

java springboot jsp

Preface: complete front-end noob and javascript neophyte.

Goal: if an object is not added to the DOM remove some elements already present

IndexController.java

boolean isDeleteAddButtons = true; if( isDeleteAddButtons ) { mv.addObject("this_might_work", true); }

index.jsp ( assume the 3 elements are present and functional)

...... </body> <script> var isProof = '$(#this_might_work)'; if( typeof(isProof) === 'undefined') { document.getElementById('popupBar_insert_add').remove(); document.getElementById('popupBand_insert_add').remove(); document.getElementById('popupEvent_insert_add').remove(); } </script> </html>

What am I doing wrong/not doing right?

Read Entire Article