Reputation: 67
I'm trying to get the data-events value using jQuery and then change the background color of the div. This is my current situation:
<div class="fc-content" title="" data-events="Work In Progress"></div>
jQuery(document).ready(function($) {
$("div[data-events='Work In Progress']").next().css('background-color:','#000000;');
});
The purpose is because I want to filter certain events that have a value of 'Work In Progress' and change background-color to black.
Upvotes: 0
Views: 48
Reputation: 956
Use jQuery attribute selector
Change your code to
$("div[data-events='Work In Progress']" ).css('background-color', 'black');
Upvotes: 0
Reputation: 298
You can get the div by doing the following:
var eventInProgress = $("div[data-events='Work In Progress']");
eventInProgress.css("background-color", "#000000");
Upvotes: 1