I am setting a data-position
attribute on document ready via jQuery on several divs. The setting definitely works. For example, calling the below code in the Chrome console is returning 'left'
.
$('.card-container').data('position');
However in the CSS the below is not doing anything.
[data-position='left']
Hard-coding data-position="left"
in the div is working though. What am I doing wrong? Thanks for the help
data
doesn't actually add the data attribute to the markup, so it won't affect css. You should add a class instead. – Cutler