[jQuery] Traversing up the DOM to make a decision (using NOT or otherwise?)

[jQuery] Traversing up the DOM to make a decision (using NOT or otherwise?)


Hello all,
I am relatively new to jQuery having used prototype since it's
inception. I am attempting to affect all anchor tags on a page except
for those contained in a certain IDed element.
Basically, we have some wizard forms that will contain A tags used in
the form interaction that we do NOT want to be affected. All other A
tags on the page are navigation links and we would like to warn the
user that their changes will be lost if they navigate away from the
page.
I am currently using this model but would like to avoid having to
traverse the document three times if possible.
function wizardConfirm() {
    $("a").addClass("navAway");
    $("#form a").removeClass("navAway");
    $("a.navAway").click(function() {
        var exit    = confirm("You are about to leave a form and your changes
will be lost.\nClick OK to leave and Cancel to stay.");
        if(!exit) return false;
    });
}
Is there a way to use the NOT pseudo-class or something else to create
a more streamlined approach here?
Thanks in advance for your help,
Miro