158 questions
-2
votes
2
answers
56
views
Cannot read properties of undefined from For loop [closed]
I have a for loop function that loops through an HTML collection and adds an eventlistener to the elements in the collection. My problem is that I get an error about the event function being unable to ...
1
vote
0
answers
24
views
What is the difference between nodelist and html collections and how do they differ from a normal array? [duplicate]
I am beginner at javascript so I need to understand the intricacies of the language to code better and to score between at the interviews I am learning javascript from Hritesh chowdhury sir
I watched ...
0
votes
1
answer
543
views
How to remove multiple DOM elements using a single function in JavaScript?
I'm working on a project where I need to remove multiple DOM elements from the page. Sometimes I need to remove a single element, and other times I need to remove a collection of elements (like a ...
0
votes
0
answers
38
views
HTML collection has elements but indices are null [duplicate]
I have a table and want to color the numbers based on their amount. Therefore, I try to get the innerHTML (with the number) of the td's with class="account-balance" in javascript.
The ...
-1
votes
1
answer
57
views
How to convert HTMLcollection returned when using getElementsByClassName into Array [duplicate]
Array.from() or Array.prototype.slice.call() or using for loop to add htmlcollection into array not working on converting HTMLcollection from getElementsByClassName into array so that i can iterate ...
0
votes
1
answer
85
views
How to dynamically update an HTMLCollection using x and y coordinates
I am working on a battleship game and I am trying to update the x and y coordinates on an HTMLCollection. The way I am trying to update is not working because I am accessing it as a 2d array when it ...
1
vote
1
answer
63
views
How to keep updating array created by converting html collection?
So, I'm creating this system of adding and removing boxes. By default, there are 4 boxes. Users can delete those boxes or add new boxes. Problem is that I can only remove the default 4 boxes I created ...
1
vote
1
answer
95
views
Is the element accessed as the value of the name attribute of the form element HTMLCollection?
for (let i of document.formBox) {
console.log(i)
};
<form name="formBox">
<input name="inputOne">
<input name="inputTwo">
<button name='btn'>BUTTON</button>
</...
0
votes
2
answers
72
views
What is the best way to handle events on dynamically generated input fields
I'm looking for the simplest way to handle different events on dynamically generated input fields.
Using MutationObserver looks complicated because requires processing each MutationRecord from the ...
0
votes
2
answers
350
views
Extra text node in nodelist?
I have a section element having 3 div parent elements, I want to log section children.
<section class="section1">
<div class="parent">
<p class="childP">hello&...
2
votes
2
answers
619
views
Why am I getting an empty array when converting an HTMLCollection into an array?
I am trying to convert tableBody.children (HTMLCollection) into an array so that I can loop through it. To do this I am using Array.from(tableBody.children and assigning it to a variable, ...
0
votes
1
answer
122
views
Why can't I access elements in an HTML collection on the NYT crossword page?
I'm trying to write a Chrome extension that adds "previous puzzle" and "next puzzle" buttons to the toolbar on a New York Times Crossword page. I hate having to navigate back to ...
-1
votes
1
answer
559
views
How to convert HTMLCollection to Array - Performance Point of View for around 50 Items [duplicate]
I am trying to develop a reusable accordion component where I have to find all the accordion items which are giving me HTMLCollection which seems like an Array form but if you go and try to manipulate ...
1
vote
2
answers
82
views
Parsing Childnode values in javascript
I have an XML
<root><example><examplevalue>exampletext</examplevalue><examplevalue>exampletext2</examplevalue</example></root>
and I have the following ...
1
vote
2
answers
108
views
Using arr.every() on [...HTMLCollection] doesn't return true element change
I'm trying to build a Tic Tac Toe game so I tried to collect the playbox areas in an array by first using getElementsByClassName() before using spread operator to convert the collection into an array.
...