I want to style the elements which are created after the form submission. The form itself is created by the JS script and I don't have access to it.
I already managed to get it working using setInterval
Is there some better solution?
setInterval(function () {
if (document.querySelector('.submitted-message')) {
document.querySelector('.submitted-message').style.cssText = "display: flex; font-size: 20px"
}
}, 100);
asked May 20, 2021 at 10:05
-
1There is absolutely no problem with this. It is clearly readableSiddharth Shyniben– Siddharth Shyniben2021年05月20日 10:13:25 +00:00Commented May 20, 2021 at 10:13
1 Answer 1
Yes. Create a CSS class that is loaded by default:
.someClass{
color:red;
}
and when you create your new elements, make sure that their class attribute contains someClass
.
EDIT It looks like the elements already have a class of submitted-message
, so just create a CSS rule to target that class:
.submitted-message{
display: flex;
font-size: 20px
}
right?
answered May 20, 2021 at 10:08
Sign up to request clarification or add additional context in comments.
Comments
default