Having trouble with your mobile dropdown menu not responding to clicks?

I'm having trouble getting a dropdown menu to work on the mobile version of my website.

When I click on the dropdown menu image, it's supposed to appear, but it's not working as expected.

JSFiddle: https://jsfiddle.net/xfvjv184/

Included files:

     <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquerymobile/1.4.3/jquery.mobile.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

HTML

<div class="mobile_dropdown_menu_icon">
    <img class="mobilemenuicon" src="resources/mobilemenuicon.png" />
</div>

<div class="mobile_dropdown_menu">

</div>

CSS

    .mobile_dropdown_menu_icon {
        display:none;
    }

    .mobile_dropdown_menu {
        display:none;
    }

@media(max-device-width:500px) {

    .mobile_dropdown_menu_icon {
            display: block;
            float:right;
        }

    .mobilemenuicon {
            width:150px;
            height:150px;
            margin-top:10px;
            margin-right:20px;
        }

    .mobile_dropdown_menu {
            background-color: red;
            height:400px;
            width:100%;
        }

}

jQuery

$(document).ready(function(){

    $('.mobile_dropdown_menu_icon').on("click" function() {
        $('mobile_dropdown_menu').css("display", "block");

    });   
});

I can't figure out why this isn't working as intended. Clicking the icon should display the mobile_dropdown_menu, but it doesn't with this code.

Answer №1

Here is a small correction:

$('mobile_dropdown_menu').css("display", "block");

It seems the line above should include a period in front of mobile_dropdown_menu.

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

Logging in using Mechanize with a jQuery AJAX submission form in Python: A Step-by-Step Guide

Currently, I'm experiencing difficulties logging into the system due to the way the website is handling the form using jQuery and ajax in the following script: function form_login() { if($('#main form p.button.disabled').length) return ...

The file module.js is encountering an error at line 327 because it is unable to locate the module named 'express

Hey there, I'm new to nodejs and whenever I run a file in the command prompt like:- C:\demoData>node demo.js I encounter an error like this: module.js:327 throw err; ^ Error: Cannot find module 'express' at Function.Modu ...

Can you show me a way to use jQuery to delete several href links using their IDs at once?

Currently facing a challenge with removing multiple href links that share the same ID. Here is a snippet of my code: $('.delblk').click(function(e) { e.preventDefault(); var id = $(this).attr('id').substr(7); ...

Once an email address is entered, kindly instruct the driver to press the tab key twice for navigation

Adding a user to a website involves entering an email address first, which is then checked against the server's list of users. However, the issue arises when the email validation doesn't occur until clicking outside the input box or pressing tab ...

The PHP file I'm trying to access isn't receiving the GET request from my PHP script

Basically, I want a button on one php page to trigger the printing of a new php page. This feature is working perfectly. The only issue is that I am trying to ensure the user ID gets passed over to the second page and displayed there. Strangely, it seems t ...

Tips for saving data to a file using the frontend

Is it possible for draw.io to write directly to a local file from my browser without the need for any server app or browser extension? I'm not referring to simply downloading a file, but actually writing to a file. For example, when creating a new dia ...

Postpone an automatic action in React

I'm currently working on adding a fade out animation to a page change in React, but I need to delay the click event before the page actually transitions. Here's the code snippet I have so far: export default function Modal({setTopOf}) { const ...

Is there an alternative function that can be used in place of live() in jQuery version 1.26?

$('#data').find('div:eq(0)').append('<span class="show"> | show more</span><span class="hide"> | hide content</span>') $('div:gt(0)').hide(); $('.show, .hide').on('click', ...

Warning: Unhandled promise rejection occurred while running the test

Currently delving into the world of selenium with a focus on testing the registration page. I've crafted a registration page class equipped with methods for monitoring registrations. However, upon attempting to execute a test within the application cl ...

How to send PHP email using HTML form

After attempting to find an answer to my inquiry here, I am now starting a new thread. Just a brief explanation: I have a Contact Form with 180 input fields and calculations for each field. I wish to send all the fields along with the calculated values v ...

Automatically generate numbering for an AngularJS ng-repeat list

I'm working on creating a student report list using Angularjs ng-repeat. My main issue is figuring out how to dynamically append numbering like an ordered-list to the generated list in the view. I am aiming for something similar to this: # | Name of ...

Ways to determine if a variable's value is changing while scrolling?

Currently working on a jQuery project where I have a variable that changes values based on scrolling. I need to determine when this value is increasing or decreasing as the user scrolls. Any suggestions on how to accomplish this? Thanks! ...

The React application ceases to function properly as soon as I introduce a textfield

As a newcomer to React, I am facing an issue while working on the front-end UI of a web application. Whenever I try to add a text field to the box I created, the app fails to render anything other than a blank color on the screen. Here is how it looks: W ...

I'm looking for a streamlined method to simultaneously access multiple APIs with GraphQL and React

For my client side project, I'm using GraphQL and React but opting not to use Redux for state management. Instead, I have organized my API calls into custom hook files as shown below: const [getSomeData, { data: getSomeDataData, loading: getSomeData ...

The property number will have no effect on the time

Currently, I am in the process of developing an audio player that includes essential functions such as backward, play, and forward buttons. Strangely enough, the backward function operates perfectly fine, but the forward button is not functioning properly ...

During the rendering process, the property "quote" was accessed, however, it is not defined on the current instance. (Vue.js)

Every time I try to retrieve data from the kanye API, I encounter this error message: Property "quote" was accessed during render but is not defined on instance. Below is the code snippet that triggered the error: <template> <div> ...

Angular directive preventing default action but Chrome still loading image on drag

Has anyone encountered an issue with an angular directive that is not successfully preventing Chrome's default action? Below is the code for the directive in question: app.directive('fileDrag', function () { return { restrict: ' ...

Issues with CSS rendering have been encountered on the Facebook page

I'm experiencing an issue with the rollover CSS on Facebook's rendering engine. I'm not sure if I made a mistake in my code or if there are limitations with certain CSS properties on custom Facebook pages. Here is the code I am using: <l ...

Determining the Similarity of jQuery Selectors' Selected Elements

I'm looking for a way to programmatically identify if two jQuery selectors have chosen the exact same element. My goal is to iterate over multiple divs and exclude one of them. This is what I envision: var $rows, $row, $row_to_exclude; $rows ...

The calculator is experiencing issues with JavaScript functionality

Having some trouble developing a calculator using HTML5, CSS, and JavaScript. After passing my HTML and CSS through validators successfully, I encountered issues when adding JavaScript functions to enable the functionality of the buttons on the calculator. ...