0👍
ClassList.contains
returns a boolean value.
you can see more documentation here
i think what you might be trying to do is
title.value.style.backgroundColor = "red";
- [Vuejs]-Can a component be found using its key?
- [Vuejs]-How to pass parameters with Inertia to Laravel controller?
0👍
I did not use TS for reproduction of the problem, but I found two mistakes in your code.
The first one is that you use dot "." inside contains(".title") and it’s not needed.
The second one is that you are trying to add some styles not to DOM element, but Boolean, that is returned after contains(".title") part of your code.
My solution is here
if(title.value.classList.contains("title")) title.value.style.backgroundColor = 'red';
Source:stackexchange.com