Wrapped Set: "Brother" Selector (with :first parameter) doesn't work

Wrapped Set: "Brother" Selector (with :first parameter) doesn't work

Hello Everybody,

Since I'm new in this forum, I would like to introduce my self first. My name is Luciano Daher, I'm speaking from Brasil (with 's') and I would like to ask about an issue I'm facing here. I've read "jQuery in Action" as a tutorial, and, at the end of the chapter 4, the book presents a sample script called "bamboo.html" (is about a Chinese Restaurant). I've tried to reproduce the same sample myself, but, when I use the following wrapped set (bold text) within the anonymous event handler function...

$('span[price] input[type=text]').change(function(){
       $('~ span:first', this).text(...);
});

... it doesn't work. The funniest thing is that the book's sample works perfectly. Even if I copy the entire sample script and replace my script with it, it insists not working. Doesn't matter the browser I use (although the current one is Google Chrome). What I've done to avoid this silly error, was to remove the ":first" parameter from the wrapped set and everything works fine. Someone here might asks why I'm bringing this issue up since I've found a solution, but, there might be an answer for that, without mention the fact I'm very curious.

Sorry if I haven't expose more information about the script. If it's necessary to expose more about the mentioned script, please, let me know.

Thanks in advance.