I have many divs like this
<div class="msg_header msg_header_for-219 media data-message="219">
...
</div>
I use
$(".msg_header_for-<%= msg.id %>").css("background-color", "red");
to pick a specific id and color it red.
I want to color the rest of the divs white
so I have 2 lines
$("[class~='msg_header_for']").css("background-color", "white");
$(".msg_header_for-<%= msg.id %>").css("background-color", "red");
the first one, as I understand, will select any class with msg_header_for in the class name and make it white. the second one will pick a specific one and color it red.
The red part works. The white one doesn't.
I don't understand why the first selector doesn't work. What is wrong?