What you're looking for is probably

$("a.newWindow").click( ... );

which searches for all <a> elements that have a class of "newWindow"[1].

The second parameter to $() represents the context in which you are
searching. In other words, it answers the question "where does jQuery start
searching from?" The context defaults to the entire document, which is why
you don't see it used very often in examples.

Hope this helps,

Aaron

[1] This is standard CSS syntax. A complete list of supported CSS selectors
(which, strangely, doesn't mention the class selector I just showed you) can
be found at http://jquery.com/docs/Base/Expression/CSS/

On 12/15/06, Christopher Jordan <[EMAIL PROTECTED]> wrote:

 This should be a quick one.

I know there's a way to do this, but it escapes me at this time.

I've got a few <a href...> tags on my screen, and I want some of them to
open in the same window and some to open in a pop up, sized specifically.

Here's what I've got so far:

<script>
    $(document).ready(
    function (){$("a", ".newWindow").click(
        function(){
            // there's more than just width and height, but you get the
idea.
            var handle = window.open(this.href, 'some_target', 'width=550,
height=500');
        });
    });
</script>


I've tried this same idea with the following changes:
   ... $("a", "#newWindow").click(...
and
   ... $("a", newWindow).click(...
and
   ... $("#newWindow", "a").click(...
and
   ... $(".newWindow", "a").click(...
and
   etc., etc., etc.

Where am I going wrong. So far in my jQuery experience, I've only had need
to find elements by their class, element type, or ID. But not a combination
of those. Can someone please hit me with the correct syntax? Hit me hard, so
I don't forget it next time. :o)

Cheers,
Chris

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/




--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to