I'm attempting to create a conditional statement based on comparing strings from a CSS content attribute.
Here is my current code, but despite the strings being identical, the comparison returns false.
CSS
.right-section::before {
content:" the blue dog";
/* position: relative; */
top: -50px;
}
Javascript
jQuery(document).ready(function($) {
var content = getComputedStyle(document.querySelector('.right-section'), ':before').getPropertyValue('content');
var content2 = " the blue dog";
if( content == content2) {
console.log("CSS is running");
$("#margin-adjust").css("margin-top", "10px !important");
}
});
Here's a link to a codepen https://codepen.io/anon/pen/EXZrwB?editors=1111
Appreciate any assistance you can provide!