Opened 14 years ago
Closed 14 years ago
#3514 closed bug (invalid)
jquery.prev(expr) bug
Reported by: | trisn | Owned by: | flesler |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | selector | Version: | 1.2.6 |
Keywords: | Cc: | trisn, flesler | |
Blocked by: | Blocking: |
Description
eg: <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01 TransitionalEN"
<html> <head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script> $(document).ready(function(){
$("p").prev("div").prev("div").css("background", "yellow");
}); </script>
</head> <body>
<div><span>Hello</span></div> <script type="text/javascript">
(function($){ $(document).ready(function(){
});
})(jQuery); </script>
<p class="selected">Hello Again</p> <p>And Again</p>
</body> </html> As such a situation,they were spacing of the some javascript code.prev() isn't work.This is bug?
Change History (1)
comment:1 Changed 14 years ago by
Cc: | trisn flesler added |
---|---|
Component: | unfilled → selector |
Resolution: | → invalid |
Status: | new → closed |
You're calling prev('div') twice and there's only one div.
Also, prev() returns just the first neighbor. If you want all the previous, you need to use prevAll().