Skip to main content

Bug Tracker

Side navigation

#3514 closed bug (invalid)

Opened October 23, 2008 09:12AM UTC

Closed October 23, 2008 12:00PM UTC

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"

"http:www.w3.org/TR/html4/loose.dtd">

<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?

Attachments (0)
Change History (1)

Changed October 23, 2008 12:00PM UTC by flesler comment:1

cc: → trisn, flesler
component: unfilledselector
resolution: → invalid
status: newclosed

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().