Can't understand why this code changes color of DIV element to blue, but doesn't change color of a SPAN element. Any ideas?
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("#prev ~ div").css("color", "blue");
$("#prev ~ span").css("color", "red");
});
</script>
</head>
<body>
<span id="prev">span#prev</span>
<div>div sibling</div>
<span>span sibling</span>
</body>
</html>
Noticed what if I replace
<span id="prev">span#prev</span>
with
<p id="prev">span#prev</p>
both DIV and SPAN change text color.
Thanks!