Avatar of jeremyll
jeremyll

asked on 

Jquery: remove div X if div Y does not exist

I would like to use Jquery to remove div X if div Y does not exist

The jquery below doesnt' work,

$(function () {
if ($("#ctl03_LeftNav").length == 0) {
        $("#left_container").remove();
)
});


<div id="content_container">
            <div id="left_container">
              <!--  <div id="ctl03_LeftNav">-->
                <!-- Empty white space -->



                <!--</div>-->
            </div>
            <div class="right_container" id="ctl03_right_container">
                <div class="content">
                </div>               
            </div>
        </div>

Open in new window

JavaScriptWeb DevelopmentCSS

Avatar of undefined
Last Comment
Chris

8/22/2022 - Mon