Bug Tracker

Modify

Ticket #11279 (closed bug: invalid)

Opened 16 months ago

Last modified 16 months ago

prev() does not filter by selector

Reported by: juandavid1707@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

See this  http://jsbin.com/ocuxad/4/edit.

Or,

in javascript

x=$('select#per_page').prev('#page');
console.log($('select#per_page'));
console.log(x); // returns []

in html

<input id="page" name="page" type="hidden" value="1">
 <input id="per_page" name="per_page" type="hidden" value="25">
 <select id="per_page" name="per_page">
  <option value="10">10</option>
  <option value="25">25</option>
  <option value="50">50</option>
 </select>

Change History

comment:1 Changed 16 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

That markup is invalid, it has two elements with the same id. Please ask for help on the forum or on StackOverflow. Also see the documentation for .prev(), it seems you expect the method to look back until it finds what is in the selector and that is not the case.

 http://api.jquery.com/prev/

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.