CSS and jQuery code to create a nested dropdown menu

As a beginner in CSS and HTML, I am struggling with creating a clickable menu for devices. The menu will be nested under a hamburger icon and needs to have multiple levels of nesting. While I successfully implemented the top-level dropdown menu following a tutorial, I am facing difficulties with the deeper nested list. Can anyone provide assistance?

Here is how my HTML looks:

<nav id="MainNavigation">
   <a href="#" id="menuIcon"><img src="images/menu_logo_webb_design.svg" alt="Menu icon"></a>
    <ul id="dropDownMenu">
      <li> 
       <a href="#" title="Woman">Woman
       </a>
       <li> 
       <a class="Sub_Menu_Link" href="#" title="Womanplus">+
       </a>

        <ul>
          <li><a href="#">1</a> </li>
          <li><a href="#">2</a> </li>
          <li><a href="#">3</a> </li>
          <li><a href="#">4</a> </li>
          <li><a href="#">5</a> </li>
        </ul>
        </li>
      </li>
      <li> <a href="#" title="Man">Man</a>
       <li> 
       <a class="Sub_Menu_Link" href="#" title="Manplus">+
        </a>

         <ul>
          <li><a href="#">1</a> </li>
          <li><a href="#">2</a> </li>
          <li><a href="#">3</a> </li>
          <li><a href="#">4</a> </li>
          <li><a href="#">5</a> </li>
        </ul>
        </li>
      </li>
      <li><a class="Sub_Menu_Link" href="#" title="Sale">Sale</a></li>
    </ul>
  </nav>

And here is my CSS:

nav>a{
    display:block;
    background-color:red;
    padding: 0 20px;
}

nav ul.open{
    display:block;
}
...
//CSS code continued

Lastly, my JQuery code:

// JavaScript Document
$(document).ready(function(){


    $("nav a").on("click", function(){

        $("nav > ul").toggleClass("open");
    });


    $(" .Sub_Menu_Link").on("click", function(){
            $("nav ul>ul").toggleClass("open");
            });
}); 

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Explain the usage of Razor syntax when defining the name attribute in HTML

Currently, I am utilizing MVC 5 and Razor 3 to dynamically generate an attribute name in HTML using Razor syntax. Specifically, I am focused on creating a data-* attribute. This pertains to determining the name of the attribute rather than its value. Her ...

An incorrect date format was inadvertently transmitted to the server during the process of updating the jqxgrid

Issue arises with the date data format being sent to the server during an update row event. The date is received as "01.01.0001 00:00:00" for all data sent. Prior to sending, the client-side sees the row date data as "Sat May 05 2012 00:00:00 GMT+0300 (GTB ...

Is there a way to change the input value when it loses focus?

Can anyone help me understand why this code loses focus when clicked? The goal is to make these fields editable when the URL parameter 'action' is set to edit. Currently, I can switch to edit mode, click on the title to get the context into the ...

Problem with the transform attribute in CSS

Having trouble rotating a div within another div. I tried using the transform property but it's not working as expected. I heard about another method which involves using :before pseudo-element, but I'm not sure what's wrong with that either ...

Utilizing Jquery within a Personalized Post Layout

Being a beginner in jquery, I managed to create this functionality - http://jsfiddle.net/t2x9G/3/ Currently working on a Wordpress project and exploring ways to have the dynamic text content pulled from a post rather than hardcoded in the script. $(&apos ...

How can I properly assign the final value after applying a discount to prevent undefined index errors?

Developed a new coupon code system for the admin to generate coupons. In the process, there is a need to calculate the final amount to be paid after applying the discount. An if statement was utilized as shown below: if(!empty($discountCode)) { $amou ...

Enhancing your JQuery Select2 plugin by incorporating a Checkbox feature

I am currently utilizing the jQuery select2 plugin to enable multiple selections. My goal is to incorporate a checkbox for each selectable option. Depending on whether the checkbox is checked or unchecked, the dropdown option should be selected accordingl ...

Newbie Inquiry Renewed: What is the best way to convert this into a functional hyperlink that maintains the data received from the ID tag?

I have no prior training etc. If you are not willing to help, please refrain from responding as I am simply trying to learn here. <a id="player-web-Link">View in Depth Stats</a> This code snippet loads the following image: https://i.stack.i ...

Centered scaling of SVG graphics

Lately, I've been exploring ways to make my website's logo fill the entire background in a unique way. The concept is to have the browser viewport gradually "dive" into the center of the logo. In order to achieve this effect, I decided to create ...

The legend in the fieldset is not displaying correctly due to overflow issues

Within my fieldset, there is a legend structured as shown below: <fieldset class="fieldsetStyle"> <legend class="fieldsetLegendStyle"> <div> <h:outputText value="#{msgs.LABEL_AJOUTER_U ...

Launch Internet Explorer and input variable values (such as ScriptEngineMinorVersion)

I am looking to create a script that can open a file and inject values into it. Here is a basic example: Set WshShell = WScript.CreateObject("WScript.Shell") Return = WshShell.Run("iexplore.exe google.com", 1) However, I also need to modify some variab ...

What is the best way to select an element that is currently visible but hidden underneath another element?

I have developed a circular graphic using primarily HTML and CSS, with some JavaScript and JQuery functionalities incorporated for text curving and planned interactions in the future. However, I've encountered an issue where clicking on the upper rig ...

Using Div in Bootstrap to Overlay Text on an Image

Trying to overlay text on an image using the code snippet below; https://i.sstatic.net/7jkEC.png <div class="wrapper"> <img src="https://cdn0.vox- cdn.com/thumbor/qLH7593e3D2SSSIdkwgBWdYhjjk=/289x0:802x684/400x533/filters:forma t(webp)/cdn0.vo ...

Guide to Retrieving the Value of the Radio Button in Django

Welcome to my quiz app development journey! Here is a snippet from my HTML file: {% for question in questions %} <p>Q){{question.name}}</p> <input type="radio" value="1" name="{{question.id}}">{{question.o ...

Customize a jQuery image slider with varying image widths for a unique touch

I am working on a project to create an image slider with specific requirements: - Infinite loop - Two rows - When the next or previous button is clicked, the slider should move by the width of the upcoming image. Below is a snippet of my HTML: <div c ...

Fixing the error message "page attempting to load scripts from an unauthenticated source"

Can you help me troubleshoot an issue on my PHP page with ad scripts? I recently switched my site from HTTP to HTTPS and now the scripts are not appearing. Here is the error I found in the dev console: Failed to load resource: the server responded with ...

Resolving conflicts between Bootstrap and custom CSS transitions: A guide to identifying and fixing conflicting styles

I am currently working on implementing a custom CSS transition in my project that is based on Bootstrap 3. The setup consists of a simple flex container containing an input field and a select field. The functionality involves using jQuery to apply a .hidde ...

Uploading Multiple Files with Ajax and jQuery

I've been trying to implement an ajax multiple file upload form, but I'm facing issues with its functionality. Here is the HTML Code: <form method="post" id="postfrom" enctype="multipart/form-data"> <input type="file" name="file" i ...

The Jquery nextUntil() function isn't finding a match for my elements

document.addEventListener('DOMContentLoaded', function() { collapsed = $(document).find('.off'); collapsed.closest('table').nextUntil('.head', 'tr').not('head').hide(); }); <script src="ht ...

Enhancing the aesthetic appeal of a form

I have created a form in HTML that utilizes JavaScript to pull data from a database. I am looking to style the form, but I'm unsure of how to proceed. Below is the form along with some CSS code. How can I integrate the two together? <form id=" ...