I have this code :
When i add a table :
http://jsfiddle.net/VAkLn/7/
this stop working.
Why?
Solved:
I change This:
price = self.next(“.price”),
To:
price = $(“.price”),
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The reason your first example works is because
trandtdelements are only valid in atableelement. The browser effectively strips out those invalid tags in the DOM which leaves you with a structure similar to:Check it out in Firebug or Webkit Inspector.
The
next()selector works here becauseinput.priceis the immediately following sibling of each element in the set of matched elements.As soon as you include a wrapping
tableelement, thetrandtdelements are valid in the structure and get placed in the DOM as you would expect:This breaks the
next()selector becauseinput.priceis no longer the immediately following sibling of each element in the set of matched elements.The solution is to modify your jQuery selector for
input.priceto navigate the new structure:Updated your fiddle.