I’m trying to connect to my MongoDB database and I’m getting this error Answer You are attempting to use require() inside an ESM module (you can see the Object.loadESM in the call stack of the error) which tells us it’s an ESM module. You can’t use require() in that type of module. Ins…
Tag: javascript
How to put div over image with HTML and CSS?
I’m still a beginner in programming and I’m doing a project to improve knowledge. I need to insert a div with text on top of an image, I’m trying to recreate the example of the image below: Half of the div is an image and the other half is text. Can you tell me how I can do that? Here’…
Local Storage is overwritten instead of the new elements being added (JavaScript)
I want to storage an array of objects in local storage but I just can storage one object into the array. All the new objects are overwriting the previous one in index 0. This is my JavaScript code: Thanks in advance!! Answer get the current content of the local storage first and then put the new objects into …
Javascript create iFrame dom innerHTML
gives Error: Uncaught TypeError: Cannot read property ‘body’ of undefined how can i fix this? Answer to add content to iframe, you should pass by src attribute, here is an example. if your content is url, you put it directly into src,like this
Error onchange (function) is not defined at HTMLSelectElement.function
I’m a beginner in programming and today I need your help!(please :'() I want to create a survey,so I begin to code and a error appear and I search a lot in internet but no solution. There are my html and js codes. Answer You did not specify an incomplete call to the selector – getElementById(̵…
How do I implement a button, that checks if the fields in a document are not empty? JavaScript
I want to write a JavaScript function, that checks if the fields in the following HTML document are not empty. I do not want a prompt for every information but instead I want to implement a button at the end, that checks every field and returns a message that tells you which fields are still not filled. I sta…
redux state gets -improperly- updated before reducers is called (w/ ReactDnD)
Edit: the bug was is a separated helper function that was mutating the state (not displayed in the post). I’m experimenting with ReactDnD to create a sortable image grid via drag and drop. I’ve been …
React-Leaflet Map doesn’t update
My issue is that react-leaflet <MapContainer> doesn’t center on a position that I set dynamically. The basic logic is that I have a form where I enter Street and House Number, then I make call for Nominatim and get some JSON format data, from where I extract latitude and longitude of a building. T…
How to reverse an infinate animation in Web Animation API?
In Web Animation API, we can animate elements by Element.animate interface. The returned Animation object can be played, paused or reversed by .play(), .pause() and .reverse(). I get this error when i try to reverse() the animation: Cannot play reversed Animation with infinite target effect end. Answer The be…
Search nested array of objects and return whole path of all matching items
I would like to search a deeply nested array of objects and return the path of all matched objects. I have partial solution of the problem but the code returns path of only first matched object. Please have a look at the input, expected output and the code itself. I have commented the desired logic in the exp…