Q:

Navigation drawer is not getting displayed on clicking on the icon

I am creating a web-page in which I have a side navigation drawer at the left and the main content at the right. On clicking on the icon to display the navigation drawer , it is not getting displayed.
My HTML CODE:
<div class="navContainer" >

<p id="headingOfThePage">Wedding Planner</p>

<div class="navDrawer">

<ul>
<li><a href="javascript:void(0)" class="closebtn" onclick="closeDrawer()">&times;</a>
<li><a href="#">Home</a></li>
<li><a href="#">Sign-In</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Share</a></li>
</ul>

</div>
<div class="drawerIcon">
<span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776;</span>
</div>

</div>

My css code is:
    .navContainer{
    width:100%;
    height:50px;
    background-color: lightblue;
    display:"inline"

}

.navDrawer{
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
    display:"inline"

}

.navDrawer a{
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display: block;
    transition: 0.3s;

}

.navDrawer a:hover, .offcanvas a:focus{
    color: #f1f1f1;
}

.navDrawer .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
}

@media screen and (max-height: 450px) {
  .navDrawer {padding-top: 15px;}
  .navDrawer a {font-size: 18px;}
}

The script which I have attached to the navigation drawer icon is:
<script>

function openNav() {
    $("#navDrawer").css("width","250px");
}

function closeNav() {
    $("#navDrawer").css("width","0px");
}

</script>

On clicking on the navigation drawer icon , the drawer is not getting displayed.
How to resolve this?

A:

It does not work because you use #navDrawer instead of .navDrawer, since you have a element with class .navDrawer and not with id. Additionally, you're calling wrong function on close click. Consider following snippet:

function openNav() {
    $(".navDrawer").css("width","250px");
}

function closeNav() {
    $(".navDrawer").css("width","0px");
}
.navContainer{
    width:100%;
    height:50px;
    background-color: lightblue;
    display:"inline"




}

.navDrawer{
    height: 100%;
    width: 0;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: #111;
    overflow-x: hidden;
    transition: 0.5s;
    padding-top: 60px;
    display:"inline"

}

.navDrawer a{
    padding: 8px 8px 8px 32px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display: block;
    transition: 0.3s;

}

.sidenav a:hover, .offcanvas a:focus{
    color: #f1f1f1;
}

.sidenav .closebtn {
    position: absolute;
    top: 0;
    right: 25px;
    font-size: 36px;
    margin-left: 50px;
}

@media screen and (max-height: 450px) {
  .sidenav {padding-top: 15px;}
  .sidenav a {font-size: 18px;}
}
.drawerIcon{
    display:inline;
    position:relative;
    top:-60px;

}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="navContainer" >

<p id="headingOfThePage">Wedding Planner</p>

<div class="navDrawer">

<ul>
<li><a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
<li><a href="#">Home</a></li>
<li><a href="#">Sign-In</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Share</a></li>
</ul>

</div>
<div class="drawerIcon">
<span style="font-size:30px;cursor:pointer" onclick="openNav()">&#9776;</span>
</div>

</div>

