I have a div which contain row-id=”
this row-id dynamically changes
so I want to give it background color
It is a react.js project. and i want to achieve this in jsx file.
I want something like-
from DOM get element with row-id=’someId’, and give it background color
I have a DOM rendered. It contains many divs, spans etc
Now on click of a button I want to select a div with attribute row-id=’abc’
and change its background color to gray
2
Answers
I achieved it using
you can create function in which that we can add the colour change condition and then will call the function where it would be needed.
Can you share sample code , it will be useful to answer your question.