Simple selector question - Why doesn't this work: $("p:not(p:eq(2))").css("border", "3px solid red");
I am following a basic jQuery course on Lynda.com and this exercise is not working. Is this an older syntax or something? Chrome's error message is "
Uncaught Error: Syntax error, unrecognized expression: p:not(p
"
- <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document</title>
<script type="text/javascript" src="../jquery-1.8.1.js"> </script>
<script type="text/javascript">
$("document").ready(function() {
$("p:not(p:eq(2))").css("border", "3px solid red");
});
</script>
<style type="text/css">
.a { color: Navy; }
.b { color: Maroon; }
</style>
</head>
<body>
<ul id="list1">
<li class="a">item 1</li>
<li class="a">item 2</li>
<li class="b">item 3</li>
<li class="b">item 4</li>
</ul>
<p class="a">This is paragraph 1</p>
<p id="para1">This is paragraph 2</p>
<p class="b">This is paragraph 3</p>
<p>This is paragraph 4</p>
</body>
</html>