I have a scenario where I am storing an array in a button using Jquery's .data() method.
If the array happens to be empty, I want the button to appear in red color.
How can I target the button with an empty array using CSS?
var values1 = [];
var values2 = ['not', 'empty'];
$('.button1').data('values', values1);
$('.button2').data('values', values2);
button[data-values='[]'] { // THIS IS INCORRECT
color: red;
}
<button class="values1">Hello1</button>
<button class="values2">Hello2</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>