<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demo</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('div').filter(function( index ) {return index;}).css( "background-color", "red" );
});
</script>
</head>
<body>
<div data-x="4">Four</div>
<div data-x="11">Eleven</div>
<div data-x="2">Two</div>
<div data-x="3">Three</div>
<div data-x="5">Five</div>
<div data-x="9">Nine</div>
</body>
</html>
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
You could do something like this
CSS
Open in new window
HTMLOpen in new window
jQueryOpen in new window
Working sample here