Some of the forms are created and generated by dynamics.com. I try to overrule the styling by manipulating the DOM. Locally it's working, but on the server somehow the JavaScript is not working.
My js file is positioned just before the closing <body>
tag.
In the DOM the HTML is rendered like below:
<div data-editorblocktype="Field-checkboxList" style="">
<div class="lp-form-field" data-required-field="false">
<label class="lp-ellipsis" for="29239e83-42a6-ea11-a812-000d3ad7c1cb" title="">The title</label>
<input class="lp-form-fieldInput" type="checkbox" value="125810000">
</div>
</div>
I tried:
window.onload = function() {
document.querySelector("div[data-editorblocktype=Field-checkboxList] .lp-ellipsis").classList.add('bg-red');
}
But than I get this error:
Uncaught TypeError: Cannot read property 'classList' of null
With jQuery I tried the following:
if (window.jQuery) {
$('div[data-editorblocktype=Field-checkboxList] .lp-ellipsis').addClass('text-orange-500', window.parent.document);
Any ideas how to get this working?