Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: 'or' in jQuery?

  1. #1
    New Coder
    Join Date
    Feb 2010
    Posts
    81
    Thanks
    12
    Thanked 0 Times in 0 Posts

    'or' in jQuery?

    Sorry for the second thread today but;

    $ ('#navbar a') .click(function() {
    var page = $(this).attr('href');

    $('#main').load(page);

    return false;

    });
    You see
    $ ('#navbar a')
    , how could you make it so it's like #navbar a or #login a? (ie. both div's can change the #main div?

    Thanks!

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Code:
    $ ('#navbar a,#login a') .click(function() {
    var page = $(this).attr('href');
    
    $('#main').load(page);
    
    return false;
    
    });


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •