Could I use a variable attribute value to set CSS property? This is because I have one button input which are defined in a for loop coming from backend (python). For example how can I do this:
x = clicked_object.getAttribute('btnid');
$("button[attr1=x]").css('background-color', 'green');
Obviously, I can write if conditions but too much programming, looking for a smarter way.
$("button[attr1=" + x + "]").css('background-color', 'green');instead of$("button[attr1=x]").css('background-color', 'green');. Or, if you are able to use template literals:$(`button[attr1=${x}]`).css('background-color', 'green');