Skip to content

Tag: javascript

Moving Bus Icon on Google Map Using JavaScript

I’m using Javascript Google Map. I want to add a moving bus icon as the map marker will reload a new location every 5 seconds. Everything is running perfectly. I just want to add an icon that will look like a real bus, which will move on the road. I did search for that and found the following code: My

console displays Uncaught SyntaxError: Unexpected identifier

I modified the function moveElement and changed its formal parameter from elementID to element. I want to directly pass the DOM object from the function positionMessage to the function moveElement. Chrome keeps displaying an Uncaught Syntax error, and I have no idea where went wrong. I would appreciate it if …

The volume provided is outside the range [0, 1] error

I have this code to do Fade In and Out the audio of the video tag each time I execute the code. Here is the code: The code works fine and I can fade out the video. But each time I execute the function I get this error : Uncaught DOMException: Failed to set the ‘volume’ property on ‘HTMLMedia…

Make backgroundimage clickable in a CSS grid

I have a div tag with a background image. How is it possible to make that div tag into a hyperlink on larger and smaller screens? Is it something like this?: onclick=’window.location.href=”https://www.google.com”‘. HTML: CSS: Answer If you use jQuery: I think that if you have different…

Javascript: Error in Promise implementation

I’m trying to perform async function and then console log the results with the help of Promise. I’m afraid I haven’t quite grasped the concept yet. I wanted to wait till getlinks finished performing tasks and then console log the result. But the it logs the result as empty even before the ge…

Sort String Json Date

I am getting date values like that: “/Date(1560458281000)/” from an array of objects. I just want to order these dates by descending and ascending. I am open to any examples with pure JavaScript and/or moment.js By the way, hours and minutes are important. I will show it like 2014/10/29 4:50 This …