I\'m trying to check in jQuery if a div contains some text, and then add a class if it does.
So I wrote something like this:
if( $(\"#field >
Here's a vanilla Javascript solution in 2020:
const fieldItem = document.querySelector('#field .field-item') fieldItem.innerText === 'someText' ? fieldItem.classList.add('red') : '';