I have a website with a few sections that look as following:
...
<div class="row docutils">
...
</div>
...
I would like to use javascript to add a custom css class to them so they looks like this:
...
<div class="row docutils my-class">
...
</div>
...
I have tried adding a js file in the same directory and added a script reference, however this approach didn't have any effect:
$(document).ready(function () {
var testarray = document.getElementsByClassName("row docutils");
for(var i = 0; i < testarray.length; i++)
{
testarray[i].className += "my-class";
}
});
Is there a better way to solve this problem?