from the structure below I am trying to place a class on the span that follows the button but I cant seem to traverse into the div containing the span.
I can target the div fine using:
$("button").next('div').addClass('alert');
But can't get that class applied to the span directly using:
$("button").next('div > span').addClass('alert');
or
$("button").next('div').next('span').addClass('alert');
My example structure is
<button>Click</button>
<div>
<span></span>
</div>
<button>Click</button>
<div>
<span></span>
</div>