I made several divs using JS, however only one of them react to DOM Manipulation

Questions : I made several divs using JS, however only one of them react to DOM Manipulation

256

I want to change the color of all my programming divs that I created with Javascript. My Learning code should have given them all the same Earhost class name and id name, but only one of most effective them changes color or interacts with my wrong idea DOM manipulation. Can you tell me what I use of case am doing wrong, or how I can fix it?

function makeRows(rows, cols){
for (let _OFFSET);  i = 0; i < (rows * cols); i++){
  let (-SMALL  container= _left).offset  document.getElementById("container");
 arrowImgView.mas  let cell= (self.  document.createElement("div");
  equalTo  cell.innerText = (i + 1);
  make.right.  cell.setAttribute('id','box');
  mas_top);  container.appendChild(cell).className = ImgView.  "gridBox"; ReadIndicator  
}
};

makeRows(16,16);

//events

const _have  box= .equalTo(  document.getElementById('box');
document.getElementById('box').setAttribute("style", make.top  "background-color:red;");
Total Answers 1
24

Answers 1 : of I made several divs using JS, however only one of them react to DOM Manipulation

When you create multiple div's you have United to use querySelectorAll to select all Modern elements with the class .box

document.querySelectorAll('.box').forEach(box OFFSET);  => {
   box.setAttribute("style", (TINY_  "background-color:red;");
});

Top rated topics

Plotly heatmap smoothing algorithm

How to speed up a for loop using lapply?

Plotting dual recursion equations with wxplot2d always exceeds control stack

Error: node-notifier not accessible from @jest/reporters

How to transpose by keeping some condition in redshift

Type Error in Laravel 8 app when package barryvdh/laravel-translation-manager is installed

How do I obtain the _actual_ CUDA driver version?

Can I insert the text/code outside the monaco editor? the browser seems forbidden this operation

How to connect a .xml file to Java Project?

Created data not getting sent to Mongodb

Getting undefined value of imported function in react

Change output format of current_timestamp in Snowflake

Restore docker container from /var/lib/docker/containers

RangeSelector for highstock throws warning for "year" type

How to start a gRPC server in plain text mode

How can I get SQL query result except one specific row?

Is there any way to get some information with snmp without oids?

How to disable mailing in Odoo.sh

Writing a struct containing a string to pipe in C

In App Billing Library v3/v4 -&gt; 60% Payments Declined

ExtJS 7.3.0 GMap Classsic toolkit markers component

How to check null value from REDIS MGET via Jedis client in java

Why can't I successfully use the return option in c programming?

Getting the complete endpoint name of an API Gateway stage before deploying it

I want to created a rsa key put want to return single key at a time for models

Javascipt Canvas, Remove a circle after I click on it

Export 5 million records to excel in asp.net using c#?

How to find xcell xml files in zipped folder

Vector of subclasses

Two singletons are equall in Javascript

Discord.py custom profile with bio

How can i deploy spring boot app on an ovh server by vps

Using rapidfuzz on a dataframe

Importing csv file to Database using python

Textjoin and arrayformula

SpringBoot Test doesn't load Tomcat

WCF in .net core change cryptographic provider

Send Email to a list of 200 records via Apex in Salesforce

AADSTS90008: The user or administrator has not consented to use the application with ID

How to generate ASW s3 presigned URl from php and then upload multiple files in that url from javascript?

DataTables on click search per column

How to fetch variable name from calling python script/file into another file?

Storybook Failed in Very First Try in New Create-React-App

Impose datatype with read_sql_query

.Net MAUI - AppShell navigation &amp; dependency injection

DeleteView - confirm by Popup windows

Are initial and final permutation in DES always done in the same order?

Does a Java compiler optimize ad hoc instances of `Set.of`, `List.of`, and `Map.of` in loops as constants

Docker-compose up - No X11 DISPLAY variable was set, but this program performed an operation which requires it

AttributeError: module 'tensorflow._api.v2.saved_model' has no attribute 'loader'

Top