I\'m going to use various data attributes names start with for example \"data-mo-\".
Assume I have these elements:
If I get it right you want to check for data-mo so I have tried something to make this work;
function getData(index){
if(index[0].indexOf("mo") !== -1)
return true
return false
}
$.each($("span"), function(i,index){
var objectKey = Object.keys($(this).data());
if(getData(objectKey)){
$(this).addClass("valid")
} else {
$(this).addClass("not-valid")
}
})
.valid {
color: green
}
.not-valid {
font-weight: bold;
color: red;
text-decoration: line-through
}
Title 1
Title 2
Title 3
Title 4
Title 5