Category "javascript"

Trouble importing topojson-client in vanilla JS

Hey guys I can't seem to use import/export correctly on my vanilla js file. I've read a couple of tutorials and don't know what i'm doing wrong.. Here's my Java

How to align (input[type="checkbox"]+Label) to center horizontally on the page? [duplicate]

I am learning HTML ,CSS & JS, and I am stuck here. I want to align the checkbox and label to the center of the page and no matter what I t

I have some instances of a class and I pushed them into an array. Can I loop through the array and update the price of all the array objects?

I have a parent constructor like this: let list = []; class Pictures { constructor(price, title) { this.price = price; this.title = title;

get the child element value from first array irrespective of parent element name in JSON

I'm getting below response (snippet) from JSON (for detailed json response hit (GET) https://restcountries.com/v3.1/all in postman or browser) [ { "

Why my div is overlapping even I used white-space in my javascript slider?

I don't understand why the div is overlapping. I want my div to be exact I as I click next or back pages. Here is my code <style> * {

Users can decompile Source Code, how can I safely access Databases and Servers?

So, Im programming a Chrome Extension. I want to store data in a Database. I logically dont want anyone else to have access to the database. How can I make it t

PHP email script is not working in gitlab

I developed one HTML site and for that, I but one PHP email script, and I submitted the form using ajax I uploaded the file into normal Cpanel and I test it's w

Bootstrap Modal inside a table populated from a partial

This is follow up question on this (Bootstrap Modal Confirmation using ASP.Net MVC and a table) Using MVC .NetCore, I populate a "partial" view and a Table (cal

Fill treeview from custom array of objects. Recursion call

I'm using treeview to display my hierarchical data. I have following array of objects: const data = [ { id: 1, hierarchyid: "/", level: 0, name: "Mhz" },

Can anyone explain why my JavaScript map function displays two extra posts upon page refresh? Getting weird duplicates with and without errors

Hello friendly people of stackoverflow, I'm having a map function issue and I just can't put my finger on what the problem could be. Context is just for user da

Alpine.js :class not working in second element

I'm starting to look into Alpine.js and trying to understand how it works. I have some html with one button to flip the background-color in two other buttons, b

Is it recommended to pass setters from useState as props?

I am currently in a coding bootcamp and the instructor told me that it is not best practice to pass the setters defined in my useState as props to children comp

window.postmessage() data is not recieved instantly rather than i have put a setTimeout function to pass the data

I am using window.postmessage() to send the data across domains to a popup but, postmessage is not sending the data instantly i.e. when captured on other domain

How to avoid duplicate JS code that each uses its own this? [duplicate]

I have several different classes with the same duplicate code. Aside from the different identity of each's this, these duplicate code are all

WalletConnectProvider not working with custom RPC

I want to connect custom RPC with WalletConnectProvider. But I keep getting an error of Uncaught Error: PollingBlockTracker - encountered and error. Here below

Convert HH:mm to UTC date time in JavaScript using date-fns

I'm working on an appointment booking React app where a teacher can set their virtual office hours in the form of a time slot. let availability = ["09:00", "17:

State is not Setting

I am trying to store the result of my backend, which is a list of inventories, sent from my backend powered by Microsoft .Net 6 Web API. But I can't figure out

hold an private array with module pattern js

I'm using module pattern on JS. Trying to make 2 private properties which first property will hold the number i.e 3. The second property is array of string whic

Incrementing a "PlayerID" with a MongoDB Atlas Trigger

I need to have a playerID that is separate from _id and increments with each new entry into my users collection. I have tried to follow this tutorial with no lu

Make the <a> tag open two URLs (in two different pages)

I wanted to make the tag open two URLs at the same time. This is what I tried: Only HTML <a href="URL1" target="_blank" onclick="window.open('URL2');">te