Let’s say I create my image CSS to be something like:
img {
border: 5px solid;
border-color: #35E415;
}
Is there a way I can change the border-color in JavaScript?
For the record, I’ve tried assigning the image an id, using getElementById, and changing it with .setAttribute and .style.borderColor. Neither have worked.
Essentially I’m trying to change the border color to red if the twitch channel is offline in this:
If you try to select your img with javascript, console.log() it to see what it returns…jQuery and JS simply don’t return the same thing, for js you might have to write something like
Well turns out I spoke too soon. That did not work as intended but it did at least work to some extent. I should be able to solve the issue from here, I’m just busy right this minute. I’ll let you know when/how/if I get it to work.
Since you are already checking if a channel is online or not, why not add a class of offline or online to each div? In your css you can use: .offline{ border-color: red; }
Using $('img').css('border-color','red'); will change all borders.