I’m trying to display a specific image based on the country the user is visiting my site from. I’ve managed to use ajax and the https://geolocation-db.com/jsonp/ to capture the location information. If I check this from the US, or any other country, I’m able to output that country (using Tun…
Tag: javascript
How to have a hidden option in a dropdown?
How to have a hidden option in dropdown so that user is unable to see it. Following is the code : User shouldnt be able to see dropdown XYZ option in the dropdown. Mainly it should be hidden.This is because in the backend I’m changing one of the options to this value and proceeding.Kindly help.Thanks in…
JS for loop loops once
My problem is that I am trying to iterate over an array several times, however, my for loop will only iterate over the array once (Or so it seems to me) which causes the outcome to be wrong. What I am trying to do is loop on this array: let arr = [“e5”, “b2”, “a1”, “c…
Check if String Contains a Substring With “Catch All” Items
I’m looking to make a javascript function that can identify when a string contains a substring with a “catch all” item. Example: How would I go about making a function like this? Would I use regex for this? Answer This matches your requirements
Web app manifest does not meet the installability requirements
I try to make a progressive web app, but Lighthouse says, I don’t have enough icons, here are the Problems by Lighhouse: and there are two errors in the Fast and reliable “tab”, but this shouldn’t matter I think? Here is my Manifest.json: Where is my Problem ? Do you need some more Inf…
Can’t add an event listener to an element from an API
I am building a trivia webapp using an API and i want to add an event listener to the button with the correct answer so that when the user clicks it it will display a message saying they’re right and it’ll get a new question. Here’s how the code looks: It tells me that the AddEventListener i…
How to use the angular decimal pipe in typscript
I’m using the angular decimal pipe like this: How can I use the same pipe but on a typescript function? Answer I found in a similar question how to use it: just need to import DecimalPipe from @angular/commun and use it as a service: Also, make sure you add the DecimalPipe to your providers angular modu…
Very Simple HTML/JavaScript Button Not Working
What should be an incredibly simple button is not working. All I want is for it to log something to the console for some testing purposes, but it refuses to work. There’s the button in my HTML file, and below is the JavaScript that, as far as I can tell, should be working. All I want is for the button
Check for changes in MySQL, node.js
How can I, in this code, take the data that has been changed in MYSQL and return it in another function? For example, take the id_ticket column and use it in another function. Answer onEvent is a handler, you just need to pass a function to that handler and
Refactoring a function JS [closed]
i have a problem with my code. First, i did this code and it works well. I have two modals and i wanna to rewrite. // Modal Carrinho const openModal = document.querySelector(‘[data-modal=”open&…