That's an excellent writeup, but I already knew all of that stuff. One issue though...$('#foobar') would only return the first occurrence of foobar because it uses getElementbyID which returns the first occurrence. That's desired behavior as there should only ever be one ID of a certain name per page.
-----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Pops Sent: Tuesday, September 04, 2007 1:43 PM To: jQuery (English) Subject: [jQuery] Re: Request: Quick tutorial on jQuery filtering/limiting methods On Sep 4, 10:11 am, "Andy Matthews" <[EMAIL PROTECTED]> wrote: > Hrm... > > But that didn't work. So I'm wanting to learn HOW I can do this sort > of thing and a tutorial on these methods would help immensely. Have you tried the interactive Selector tester tool? http://www.woods.iki.fi/interactive-jquery-tester.html Kinda neat to see what you are finding. Do you have FireFox and the the FireBug Debugger? You need this to see the entire picture and how things work, and it allows you to test code in the console. One of the "Ah ha"s is understanding that Selectors find elements or nodes on DOM tree and unless you filter it, it finds ALL of the matching ones. $("xxxxxxx') <--- find all HTML <xxxxxx> tag names $("#xxxxxxx') <--- find all HTML tags with id="xxxxxxx" $(".xxxxxxx") <--- find all HTML tags with class="xxxxxx" I think the above are the top 3 items to understand. Tags, IDs and Classes Example: 1: <p id="foobar"></p> 2: <div id="foobar" class="blue" name="picture1"></div> 3: <h3 id="title1"></h3> 4: <h3 id="title2" class="blue" name="picture2"></h3> To fnd all H3 tags: $("h3") should give you 3 and 4 To fnd anything blue classes $(".blue") Should give you 2 and 4 To find all tags with id="foobar" $("#foobar") Should give you 1 and 2. Don't forget to use # for Ids in jQuery!! >From here you do filtering for more complex searching. I'm still learning much of this, but tags also have attributes. attributes are id=, name=, size=, class=, something=, that=, this=, etc. You can use the syntax to find tag attributes: [EMAIL PROTECTED] condition value] To fine all tags with name picture1: $('[EMAIL PROTECTED]') This condition finds the beginnign letters ^=, so you can use this to find all names that begins with "picture" $('[EMAIL PROTECTED]') Similarily, you can find all ids that begin with "title" $('[EMAIL PROTECTED]') You can also be specific, like find all div tags with name that begins with picture: $('[EMAIL PROTECTED]') You can so do multiple selects, like find all divs and h3 $('div h3') but if you use the comma: $('div,h3') that says find the H3 tag that is within div, I think <g> Anyway, it serves no justice to even try to go further. :-) I've been at 3 weeks, and I'm getting comfortable with it each day. You just got to explore it more, trial and error, and also as a suggestion, even study questions here and see if you can solve them. Thats how I always learn things - solving other people's problems. :-) -- HLS