Skip to content

Category: Questions

Append inside a child difficulties

This is my current situation. I got one parent called “box” which got 15 childrens inside called item. Then I got a loop where I append some text that should be inside the children div. If I append it directly inside the children the code gets messed up and I get the 15 things I want to inside in …

target child div of ID in JavaScript and CSS

I’m having difficulty targeting the child div of id=”videoContainer” and changing its style Answer You can use querySelector with the direct child operator > (and maybe first with :first-child if you have more than one child div) like this: object-fit: contain will force you video to scal…

How to make the FAQ accordion toggle?

I’m trying to make an FAQ accordion and I want it to have two main features: 1- one question and answer can be seen at a time (I managed to do that) 2- if toggling on the open question it closes, and vice-versa (that’s what i’m struggling with) Here’s a pen that has a small copy of wha…

How to remove Label from charts.js

I am using charts.js to create a charts for my website. I am unable the remove the legend from the chart. I did not found the solution. This is the first time I am using charts.js library. code: }); Thanks in advance. Answer Here is the documentation https://www.chartjs.org/docs/latest/configuration/legend.ht…

converting an array into object in typescript

I have an array of objects: Where I need to convert it to the type NFCollection which looks so: The result should looks like this: where the data includes only those persons whose age >= 18. So I could start writing something like: but then I would like to convert it to the NFCollection type. How would I d…