Skip to content

Tag: javascript

Counter inside an onClick function

I have a button that adds a new div (onClick). I want to add +1 to cargoNumberCounter so that it shows that it’s a new div. I thought I could make it work like I have shown in the example, or by spreading the state like so setCargoNumberCounter([…cargoNumberCounter, cargoNumberCounter +1]), but fo…

How can I get an ID from SVG file using javascript

I’m having difficulties in accessing an ID that is inside an SVG file and inside of a rect tag, to manipulate the SVG’s I’m using the Snap.svg library. In this case I want to get the get the id=”rect252″ in javacript file and change the visibility of this object. For some reason …