Link to home
Start Free TrialLog in
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

SOLUTION
Avatar of Chris
Chris
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Huh, wierd. I must have inadvertently fixed that when I tested the code. Well done Chris.