Report Bug

QusWhat is the correct way to change the background color of an element using DOM manipulation? QusDOM हेरफेर का उपयोग करके किसी तत्व की पृष्ठभूमि का रंग बदलने का सही तरीका क्या है?


A. element.background = "red";
B. element.style.backgroundColor = "red";
C. element.style.background = "red";
D. element.css.backgroundColor = "red";


Solution
B. element.style.backgroundColor = "red";



Explanation
To change the background color of an element using JavaScript, you need to use the style property and specify the backgroundColor attribute.
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad