I am trying to modify the CSS style of directly adjacent siblings when hovering over an element. For example, if I hover over element 4, elements 3 and 5 should have a new CSS class applied.
Check out my JSfiddle to see the expected result and what I have accomplished so far:
http://jsfiddle.net/uxa49myL/5/
$(document).ready(function() {
$("h1").hover(function() {
$(this).nextSibling.addClass("siblings");
$(this).previousSibling.addClass("siblings");
});
});
Unfortunately, it seems that the nextSibling and previousSibling jQuery functions are not working as I anticipated.