Unable to select an item using mobile devices

Whenever I check my webpage on a computer, clicking the <span> item below opens the full-screen search perfectly.

<li><span class="text-white" id="open_search" onclick="openSearch()"><i class="fas fa-search mr-2"></i>Search</span></li>

However, the issue arises on mobile devices where nothing happens when I click the span. What could be the problem?

I am utilizing bootstrap 4, but I don't believe that is relevant as this search "plugin" is quite basic and compact.

function openSearch() {
  document.getElementById("myOverlay").style.display = "block";
}

function closeSearch() {
  document.getElementById("myOverlay").style.display = "none";
}
.overlay {
  height: 100%;
  width: 100%;
  display: none;
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0, 0.9);
}

.overlay-content {
  position: relative;
  top: 46%;
  width: 80%;
  text-align: center;
  margin-top: 30px;
  margin: auto;
}

.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
  cursor: pointer;
  color: white;
}

.overlay .closebtn:hover {
  color: #ccc;
}

.overlay input[type=text] {
  padding: 15px;
  font-size: 17px;
  border: none;
  float: left;
  width: 80%;
  background: white;
  color:#333;
}


.overlay button {
  float: left;
  width: 20%;
  padding: 15px;
  background: #84bc3c;
  font-size: 17px;
  border: none;
  cursor: pointer;
}

.overlay button:hover {
  opacity:0.95;
}

#open_search { 
  cursor: pointer
}
<div id="myOverlay" class="overlay" onclick="closeSearch()">
  <span class="closebtn" onclick="closeSearch()" title="Close">×</span>
  <div class="overlay-content">
    <form method="post">
      <input required="required" type="text" placeholder="Enter product name to search.." name="search" id="search">
      <button class="text-white" type="submit"><i class="fa fa-search text-white mr-2"></i></button>
    </form>
  </div>
</div>

Answer №1

After testing the functionality of the span on both mobile and PC, I can confirm that it is working properly. To troubleshoot further, I recommend trying to access the site on your mobile device while in incognito mode to rule out any cached data causing issues. Additionally, please provide information about the browser you are using on your phone and its version number for better troubleshooting.

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

Techniques for verifying phone numbers from various countries

The number of digits in a mobile number differs from country to country. I have tried using regular expressions, however, for example, India allows 10 digits, but this does not validate UAE, where the number of digits can range from 7 to 9. ...

Need to include files within an electron / express application

I'm encountering challenges while setting up an app with: electron express (using mustache templating) firebase My struggle lies in correctly requiring files. The issue seems to stem from the varying "scope" being the electron app or express app, re ...

Is it possible to configure Cypress to always open in the current tab instead of opening in a new tab?

One challenge with Cypress is testing on multiple tabs. Our website default to opening in a new tab. Is there a way to make Cypress continue the tests on the same tab? cy.get(element).invoke('attr', 'target', '_self').click() ...

A guide on downloading and hosting Next.js documentation on your local machine for offline access

Can someone guide me on how to download and host the Next.js documentation locally for offline reference? I attempted to clone the Next.js repo containing the docs but all the files in the docs folder are markdown files, which cannot create and serve a l ...

allow the promise to pause for a few moments before completing

I have a function that returns a promise. Within this function, we are making a call to a third-party vendor to send push notifications through their server. The code looks like this: apiGetLoggedInUser.then( user => { return sendMessage(user.na ...

Steps for referencing an autogenerated id in a Firestore collection

I need assistance updating a 'progress' field in a document with an autogenerated ID (using Firestore) every time the progress button is clicked. https://i.stack.imgur.com/hZieN.png Despite my attempts, nothing seems to work. Here is the method ...

Convert a string in JavaScript by replacing spaces with '+' and use it as a link for a Google Search

I need to create a link to search Google with a specific text. To do this, I have to replace the spaces in the text with '+' and include it in the href attribute. Here is how it can be done in HTML: <a href="#" id="afd_gsearch">Search Goo ...

morris.js - displaying a dynamic line chart using JSON data

These are the resources I have: clicks.json index.html The contents of my clicks.json file: [ {"day":1,"clicks":"387"}, {"day":2,"clicks":"432"}, {"day":3,"clicks":"316"}, {"day":4,"clicks":"238"}, {"day":5,"clicks":"354"}, {"da ...

Check if the value is a string and contains a floating point number; if so, parse and format the float

I need to work on formatting decimal values returned by an API that only responds with strings. The requirement is to add a leading zero but no trailing zeros to any decimal value in the string. If the value is not a float, it should remain unchanged. For ...

When the Button is clicked, the component utilizing the Router fails to appear

My current task involves creating a page where users can choose between two options: Button 1 leads to TestOption.js, while Button 2 redirects to TestOption2 (currently using TestOption for testing purposes). The default landing page is SelectionPage. The ...

Encountering a Parse Error with Less CSS triggers an error message for unrecognized input specifically related to background properties

I am struggling to identify the issue with my CSS while using the LESS CSS library. After running my site with LESS, I encountered an error. However, upon examination, the CSS appears to be valid. Can someone please point out what could be wrong with my C ...

How to modify the content type in an Angular.js $http.delete request

When making a $http.delete request in my Angular app, I include a config object using the following approach: return $http.delete('projects/' + projectID + '/activityTypes', {data: [{id: 2}]}) This method attaches the values from my d ...

The variable that contains a function is invoked, but the result is undefined

I'm having trouble with a function that should return John temp (2021) when called, but instead it's returning John undefined (undefined) const user = { username : 'John', type: 'temp', yearJoin: 2021, user ...

Trouble encountered when trying to use an anchor link with the .slideUp jQuery function

Would you be able to assist me with understanding why my anchor links are not functioning correctly? I have 3 anchor links, for example: Google (not working) Yahoo (not working) Facebook (working) Any insights on why Google and Yahoo are not working? &l ...

Creating concise one-liner If statements with Handlebars: a simple guide

I am seeking clarification on the correct syntax for this code snippet: <li class="nav-item {{# if undefined !== user}} hidden {{/if}}"> My goal is to add the class name hidden only if the user variable exists. When I try implementing this, it res ...

Command to conceal components for users visiting as guests

I'm looking to develop a directive that hides specific elements for guest users. Here is the current code I have: angular.module('someMod') .directive('premiumUser', premiumUser) .controller('PremiumUserCtrl', Pr ...

Locate a specific class inside a div and switch the CSS style to hide one element and reveal another

I have two divs, each containing a span. By default, the display of each span class is set to none. My goal is to toggle the display property of the span within the clicked div. If the span is already visible, I want to hide it; if it's hidden, I want ...

What is the best way to sort an array based on a person's name?

I have a list of different groups and their members: [ { "label": "Group A", "fields": [ { "value": "color1", "name": "Mike" }, { &quo ...

The Layout of Bootstrap4 Form is Displaying Incorrectly

I'm attempting to create a basic email form similar to the one shown in the Bootstrap 4 documentation. However, I am facing an issue where the formatting is not displaying correctly. Here is what the example should look like: https://i.sstatic.net/qx ...

Alter the border line's color based on the specific section or div it overlays

I am attempting to utilize jQuery in order to change the color of my border line depending on its position within the divs. I have set the position to absolute and it is positioned on both divs. My goal is to make the line on the top div appear as grey, wh ...