Javascript not working on mobile

Using the on click function. It works fine at desktop but doesn't work on mobile my Samsung Galaxy S5. I've tried changing click for touchstart and experience the same thing. Works at desktop but not at mobile. Tried putting in click and touchstart but seems to have a double click effect. As the menu works by sliding in. With both settings in it kind of slides left and right a little bit but then stops. Hi Stuart, Not sure I have the exact answer for you but maybe I can help.

You definitely don't want to have both a "click" and "touchstart" event in the same event handler, because every touchscreen treats a "tap" as a pseudo-"click" event, plus will also treat it as a "touchstart" event, so you snugpak jacket review wind up firing off 2 events every time you tap that. And since both events trigger a "toggle" effect, your single tap firing twice will toggle the class on and then off at the same time -- making it look like nothing happened.

Since it sounds like you want this menu to work on desktop and mobile, I'd suggest not using "touchstart" at all, since no non-touchscreen displays recognize it, and all touchscreens interpret taps as "click" events. So use "click" and nothing else. I'm guessing that the event is correctly firing, but something about what you're asking it to do toggle the "anim" class is not doing what you expect.

I suggest you change the function to something like:. I bet it does. Once you know that, at least you can get past wondering what's wrong with the event handler it might not be wrong at all and start troubleshooting where the problem really is. If you posted your CSS it might help troubleshooting. Opened my website with chrome instead of the default internet app on my Samsung Galaxy s5 and the menu worked fine!

Tried testing on browser stack. Working on desktop browsers. For mobiles it worked on: Samsung galaxy S5, S6, S7 chrome and firefox iPhone 7 not sure if browserstack was working properly on other iPhone versions, as friends 6s worked in real life but not in browserstack.

Which works on my default internet app. Implementing this into my website it doesn't work on my default internet app but does on chrome.

Posting to the forum is only allowed for members with active accounts. Please sign in or sign up to post. I forgot my password. Stuart McPherson 15, Points. I have a menu for mobile where when the button is clicked the menu will appear.

It works fine at desktop but doesn't work on mobile my Samsung Galaxy S5 I've tried changing click for touchstart and experience the same thing. Any help on how to get it working on mobile and desktop? Eric Butler 31, Points. Eric Butler Eric Butler 31, Points. Hi Eric, Thanks for helping out. Okay I've left out touchstart, so its just click. Tried your click function with just the alert inside. Worked at desktop. But not on mobile. Switched back to my original function.

IE10 Why is javascript not working?

Worked on friends iPhone 6S. For mobiles it worked on: Samsung galaxy S5, S6, S7 chrome and firefox iPhone 7 not sure if browserstack was working properly on other iPhone versions, as friends 6s worked in real life but not in browserstack styles.I have created a responsive site that works well on desktop, even when resized down to mobile screen size.

Javascript hides my mobile nav once clicked and shows elements properly. When viewed on mobile, the Javascript is not hiding the nav onced clicked. I apologize as I am slowly learning Javascript. The code below is what I have been using as an external script. From your description, my first guess would be that you haven't included a responsive meta tag in your HTML.

Make sure you have something like the following in your HTML head:. If you have that included and it's still not working, please post all of your code. The easiest way to do this is using a workspace snapshot. You can access this feature using the camera icon in the top right of a workspace.

How to enable JavaScript in your browser

Desktop Screenshot:. Mobile Screenshot:. I would comment that you could probably eliminate the following script by using a CSS media query to hide those elements, and then toggling the visibility with JavaScript. Posting to the forum is only allowed for members with active accounts. Please sign in or sign up to post. I forgot my password. Ashley Wile 8, Points. Ashley Wile Ashley Wile 8, Points.

Thank you for your feedback. I do have the meta tag included. I will get a snapshot together. Here is a basic snapshot of the site. Desktop Screenshot: Mobile Screenshot: Can you elaborate on the issue you're seeing? Sign in. Email Address.You may want to consider linking to this site, to educate any script-disabled users on how to enable JavaScript in five most commonly used browsers.

You are free to use the code below and modify it according to your needs. Thanks to all those who helped and contributed in any way.

Hope you find this page useful. This website uses cookies to improve performance and enhance the user experience.

How to enable JavaScript in your browser Nowadays almost all web pages contain JavaScript, a scripting programming language that runs on visitor's web browser. It makes web pages functional for specific purposes and if disabled for some reason, the content or the functionality of the web page can be limited or unavailable.

Here you can find instructions on how to enable activate JavaScript in five most commonly used browsers. Javascript is disabled in your web browser. If you enable JavaScript, this text will change. In the "Internet Options" window select the "Security" tab. On the "Security" tab click on the "Custom level In the "Active Scripting" item select "Enable". When the "Warning!

Javascript on click works on desktop but not on mobile

In the "Internet Options" window click on the "OK" button to close it. Click on the "Refresh" button of the web browser to refresh the page. Mozilla Firefox In the address bar, type about:config and press Enter.

Click "I'll be careful, I promise" if a warning message appears. In the search box, search for javascript. Click on the "Reload current page" button of the web browser to refresh the page.

Mobile Data not working on Android - Here is best tips to fix cellular data issues

In the "Settings" section click on the "Show advanced settings When the dialog window opens, look for the "JavaScript" section and select "Allow all sites to run JavaScript recommended ". Click on the "OK" button to close it. Close the "Settings" tab. Click on the "Reload this page" button of the web browser to refresh the page. Opera 1.

javascript not working on mobile

Click on Opera icon "Menu" and than "Settings". Click on "Websites" and then choose "Allow all sites to run JavaScript recommended " 3.

Click on the "Reload" button of the web browser to refresh the page. Apple Safari On the web browser menu click on the "Edit" and select "Preferences". In the "Preferences" window select the "Security" tab. Click on the "Reload the current page" button of the web browser to refresh the page.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. This works on a desktop browser, but not on my iOS mobile phone. I tried adding 'touchstart' and looked at this post's solution to check how other's got it to work, but it still isn't working. Any suggestions as to other options? I also tried adding e.

Edit: It appears there may be something else going on, I changed the code to be as general as possible and it is not firing the event on iOS, but working in my chrome emulator:.

javascript not working on mobile

As expected, the screen goes blank on my desktop browser for both local and on heroku, but when I test on mobile, the screen is not blank. It looks like js isn't working properly. Answer: the reason it wasn't working on iOS Safari is because in my js page I was using ES6, specifically 'let' which is [not supported currently][1].

Changed to ES5 and the issue disappeared. Learn more. Javascript not working on mobile but works on desktop Ask Question. Asked 3 years, 9 months ago.

Active 1 year, 1 month ago. Viewed 10k times. Images attached:. Ron I Ron I 2, 5 5 gold badges 24 24 silver badges 48 48 bronze badges. Active Oldest Votes. This should help you. Instead of binding it to the body element, bind the event to the document. I double checked to make sure in my style I added cursor:pointer, and I changed it to document. It still didn't work so I checked my browser console and saw that it was firing two events. I added e.

I think switched it from 'click touchstart' to just click, and now it fires only one event, but it is still not working on mobile.

I then tried 'touchstart' without 'click' and it is not working on mobile either. It works in my mobile emulator in chrome, but not on my iphone. You have two options: Reset your mobile browser's history because your browser's cache reads the old source. Change the name of your source file in the desktop and refresh your page again. Vickel 4, 5 5 gold badges 28 28 silver badges 48 48 bronze badges. Ahmadreza Azimi Ahmadreza Azimi 11 2 2 bronze badges. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.However, once the site is loaded on a phone or tablet some of the javascript functions stop. I say only some because all of the bootstrap files work fine and all of the inline javascript works fine. The part that isn't working is a file that I put together that helps validate various textboxes for different inputs email, phone, number only, etc.

The application is written in asp. I place a reference to the file in the body content placeholder of each page that needs it and that works fine on any device before the menu collapses. I've tried placing it in different parts of the page bottom of content placeholder, in the header placeholder as well as in the master page both in the body and header.

None of those worked. I'm sure it's something simple that I'm missing but javascript is not my expertise. I searched around but wasn't coming up with anything specific, anyone have any ideas or links I'd appreciate it Besides, your problem is caused related to mobile device, you could ask for help on this forum:. So for a number on field it returns false if not a number. Is there a different method to call for mobile devices?

Thanks for the other link, completely missed it when I was trying to figure out where to post. Reply Nan Yu All-Star. From my point of viewonfocus event will be fire on mobile deviceit fires when an element in the markup document is focusedplease refer to link below for how to debug JavaScript on Android and iOS to find out which js cause the error:.

Print Share Twitter Facebook Email. Nan Yu All-Star. NET Forum. Best Regards, Nan Yu.Keep in touch and stay productive with Teams and Officeeven when you're working remotely. Learn how to collaborate with Office Tech support scams are an industry-wide issue where scammers trick you into paying for unnecessary technical support services. You can help protect yourself from scammers by verifying that the contact is a Microsoft Agent or Microsoft Employee and that the phone number is an official Microsoft global customer service number.

I understand that you are having issues with JavaScript when using Internet Explorer. I will be happy to help you with this issue. If you can't see the Tools menu, press Alt to display the menus. Try to open a webpage on which you previously received a scripting error. If you do not receive the error, the problem is resolved.

Method 3: If you have not checked it in compatibility mode, then check in compatibility mode and check if it works. Method 4: Try updating the JavaScript from the following Java link and check. Hope this helps. Try the above steps and get back to us for further assistance. We will be happy to help you. Did this solve your problem? Yes No. Sorry this didn't help. April 14, Keep in touch and stay productive with Teams and Officeeven when you're working remotely.

Site Feedback. Tell us about your experience with our site. Why is javascript not working on my IE 10 Windows 8? This thread is locked. You can follow the question or vote as helpful, but you cannot reply to this thread.

I have the same question Microsoft Edge. Microsoft Edge Legacy.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I am part way through developing a mobile web app which contains almost no HTML elements.

Just to clarify, this is a mobile web app, not a native mobile app. This works because the previous line 71 was calling the jquery append. Your best bet would be finding a way to remotely debug what's happening in the native browser.

There are a couple ways to do this. Learn more. Asked 6 years, 9 months ago. Active 6 years, 9 months ago. Viewed 11k times. My problem is that it works ok except for on iPad Android 4.

The problem with these browsers is that the content isn't being rendered. It works fine on Android 4. Jez D. Jez D Jez D 1, 1 1 gold badge 19 19 silver badges 47 47 bronze badges.

javascript not working on mobile

Active Oldest Votes. After days of research and testing, I have found the solution. Nick Davis Nick Davis 3 3 silver badges 9 9 bronze badges. Sign up or log in Sign up using Google.

Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Featured on Meta. Feedback on Q2 Community Roadmap.