mengatur warna latar belakang CSS elemen HTML menggunakan JavaScript


Bagaimana cara mengatur warna latar belakang CSS elemen HTML menggunakan JavaScript?
function setColor(element, color)
{
    element.style.backgroundColor = color;
}
// where el is the concerned element
var el = document.getElementById('elementId');
setColor(el, 'green');

Related Posts

There is no other posts in this category.
Subscribe Our Newsletter