What could be the reason why the links within my drop-down menu are not directing me to other pages?

As I work on developing a new website, I have encountered an issue with the content inside my dropdown button not being engaging enough. Specifically, I have a link within a dropdown button located in the footer (visible on mobile), but this link does not redirect to another page.

Below is the code that I am currently using:

<div class="dropdown left-float">
    <a class="drop" href="javascript:void(0);" style="display:block; border-radius:0px !important;">
        Sitemap
        <span class="pijl-rechts" style="float:right;">
            <img src="img/caret-right.png" />
        </span>
    </a>
    <ul class="dropdown-menu" style="position:relative; display:block; width:100%; margin-top:0px;">
        <li><a href="waarom-kraamzorg-mama">Kraamzorg Mama</a></li>
        <li><a href="contact">Contact</a></li>
        <li><a href="mamapas">Mamapas</a></li>
        <li><a href="vacatures">Openstaande vacatures</a></li>
        <li><a href="algemene-voorwaardes"> Algemene voorwaardes (icoon slot) </a></li>
        <li><a href="disclamer">Disclaimer</a></li>

    </ul>
</div>

<script>
    /*Downloaded from https://www.codeseek.co/danmalarkey/dropdown-with-rotating-caret-DBrxG */
    $(document).ready(function() {
        $('.dropdown').click(function(e) {
            $(this).find('.dropdown-menu').toggleClass('open');
            $($(e.target).find('.pijl-rechts').toggleClass('open-caret'));
            e.preventDefault();
            e.stopPropagation();
            $(document).click(function() {
                $('.dropdown-menu').removeClass('open');
                $('.pijl-rechts').removeClass('open-caret');
            });
        });
        
        
        $('.pijl-rechts').click(function(e) {
            $(this).find('.dropdown-menu').toggleClass('open');
            $($(e.target).find('.pijl-rechts').toggleClass('open-caret'));
            e.preventDefault();
            e.stopPropagation();
            $(document).click(function() {
                $('.dropdown-menu').removeClass('open');
                $('.pijl-rechts').removeClass('open-caret');
            });
        });
    });

</script>

Answer №1

considering the contact, vacatures, etc links are directories, it is necessary to include a forward slash (/) before the link. The corrected code looks like this:

<div class="dropdown left-float">
<a class="drop" href="javascript:void(0);" style="display:block; border-radius:0px !important;">
    Sitemap
    <span class="pijl-rechts" style="float:right;">
        <img src="img/caret-right.png" />
    </span>
</a>
<ul class="dropdown-menu" style="position:relative; display:block; width:100%; margin-top:0px;">
    <li><a href="/waarom-kraamzorg-mama">Kraamzorg Mama</a></li>
    <li><a href="/contact">Contact</a></li>
    <li><a href="/mamapas">Mamapas</a></li>
    <li><a href="/vacatures">Openstaande vacatures</a></li>
    <li><a href="/algemene-voorwaardes"> Algemene voorwaardes (icoon slot) </a></li>
    <li><a href="/disclamer">Disclaimer</a></li>

</ul>
</div>

If these links are supposed to redirect to html pages, you can achieve that by adding .html to the links. Updated code below:

<div class="dropdown left-float">
<a class="drop" href="javascript:void(0);" style="display:block; border-radius:0px !important;">
    Sitemap
    <span class="pijl-rechts" style="float:right;">
        <img src="img/caret-right.png" />
    </span>
</a>
<ul class="dropdown-menu" style="position:relative; display:block; width:100%; margin-top:0px;">
    <li><a href="waarom-kraamzorg-mama.html">Kraamzorg Mama</a></li>
    <li><a href="contact.html">Contact</a></li>
    <li><a href="mamapas.html">Mamapas</a></li>
    <li><a href="vacatures.html">Openstaande vacatures</a></li>
    <li><a href="algemene-voorwaardes.html"> Algemene voorwaardes (icoon slot) </a></li>
    <li><a href="/disclamer">Disclaimer</a></li>

</ul>
</div>

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

Save webpage as a string in C# using ASP.NET

I am attempting to retrieve the HTML content of an aspx page from another page using the following code snippet: WebClient webClient = new WebClient(); String CompleteReport = webClient.DownloadString(new System.Uri(reportURL)); However, the returned HTM ...

Looking to incorporate Slick Carousel as the main slider on my website for a dynamic hero section using JavaScript

Currently in the process of expanding my knowledge in javascript, I am now delving into setting up Slick Carousel. It is essential that it functions as a hero slider on my website. If you are interested in checking out Slick Carousel on github, feel free ...

Is it possible for the controller of a modal window to have access to functions within the parent controller

If you were to launch a modal window using $modal.open from an angular directive, would the modal window be able to access functions defined within the parent directive? Below is the code for the directive controller: function parentFunction() { re ...

Is there a way to initiate an Edge animation when an onclick event occurs?

I am interested in incorporating an interactive Adobe Edge animation that activates upon the click of a conventional HTML form button. Could you please guide me on how to achieve this? ...

Ways to conceal ad container when ad space remains empty

After setting up my ad HTML like this: <div class="ad-container"> <p>Ad slot #1</p> <div id="ad-slot-1" class="ad-slot"></div> </div> I implemented the code below to collapse the ad if ...

using angular.js to assign a value to an <input> field

There seems to be an issue with the code, as I am unable to see the value in the HTML: '<div ng-app="BusinessinfoModule" ng-controller="BusinessinfoController" <label>Your Business Name</label> <input ...

I am having difficulty accessing the dataset on my flashcard while working with React/Next JS

I'm currently developing a Flashcard app that focuses on English and Japanese vocabulary, including a simple matching game. My goal is to link the two cards using a dataset value in order to determine if they match or not. When I click on a flashcar ...

Retrieving Dynamic data from an HTML form and saving it in PHP variables

Currently, I am in the process of taking an online aptitude test where 2 random questions are selected from a database and displayed on the webpage for answering. The issue I'm facing is that the values are not being stored correctly in the database. ...

Exploring the Differences Between Arrays of Objects and Arrays in JavaScript

While working on a project for a client, I encountered an interesting problem. I have two arrays - one with objects and one with values. The task is to populate the array of objects with new objects for every item in the value array. To clarify, here is th ...

Utilizing JQuery to Send Checkbox Selections to PHP

I have created a user login form with a "Keep Me Logged In" checkbox and I am attempting to send the value via JQuery to a PHP file for processing, but I am unsure about the correct code to use. Here is my current progress: var username=$("#username").val ...

Reduce the zoom level in Chrome to 33% or lower and watch as the text "ascends" through a fixed height div with static positioning

After recent testing of a website, I noticed that when I zoomed out to 33% or 25% in Chrome, some text in static height divs seemed to be "climbing" out of the div. Upon researching, I found information about: text-size-adjust (currently an experimental ...

Using forEach loops on arrays to insert information into JSON objects in JavaScript

I am currently working on a task that involves extracting JSON values from a structure called jsonWithListOfStatesAndCounters, based on matching elements in an array provided as input (inputedJurisdictionArray). The inputted array consists of string valu ...

The css() function appears to be failing to apply the background property to the body element

I have tried using these different methods in my code to solve the issue, but none of them seem to work. Please suggest an alternative approach for resolving this problem. // Approach 1 if ("${actionBean.backgroundImage}" != null){ $(document.body). ...

How can I ensure that Bootstrap Navbar elements are all aligned in a single line?

https://i.sstatic.net/pkxyI.pngI'm experiencing an issue with my code, and I suspect it might be related to Bootstrap. I've tried using align-items-center but it doesn't seem to work as expected. Changing the display property to inline or in ...

Accessing a local file with JavaScript using JSON (unanswered inquiries from Stack Overflow)

I need assistance in reading and parsing a local .JSON file using JavaScript. Specifically, I am looking for an example code snippet that successfully accomplishes this task. The code I currently have is unable to load the local file. var xmlhttp = new XM ...

Creating a PDF from dynamic HTML and transferring it to an AWS S3 bucket without the need to download the PDF

We have created a web application using React JS where we attempted to generate a PDF. Instead of downloading or opening the PDF in a new window, our goal is to directly upload it to an AWS S3 bucket. We have researched and tried various samples but have n ...

Displaying data as a JSON object in AJAX requests within Grails

I am looking to automatically populate employee details when an employee number is entered. Within the controller, I am executing a method that returns a JSON object: Gson gson = new Gson(); System.out.println(gson.toJson(objEmp)); return gso ...

AJAX retrieving data with a GET request

Looking to customize my page www.domain.com/page.php?x=1&y=2&z=3 Is there a way to assign values to the $_GET variables in an AJAX request using $.get()? $.get('page.php', {x: x, y: y, z: z}, function(){ }) How can I set the $_GET par ...

Clean up HTML with jQuery or JavaScript

I have a small HTML-WYSIWYG editor on my CMS and I'm curious if there is a reliable script available for cleaning up HTML on the client-side. I often encounter issues with HTML copied from Microsoft Word. Maybe using some regex could solve this proble ...

What are the differences between displaying JSON data on a Flask interface compared to a Django interface

Currently, I am looking for the simplest method to display data on a web interface using either Flask or Django (whichever is easier). I already have some sample JSON objects available. Could anyone provide recommendations on how to achieve this and whic ...