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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Posts
    152
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Fire event using JQuery

    Hello,

    I have a Jquery UI tab system and part of it is:

    Code:
    <div class="tabs-shortcode">
    <ul class="tabnav">
    <li><a  href="#1">Estate</a></li>
    <li><a  href="#2">Features</a></li>
    <li><a  href="#3">Gallery</a></li>
    </ul>

    I would like a Jquery event to be fired when the user clicks on my first image which is located above the JQuery tab system.

    This event should select the 3rd tab "Gallery" - however "Gallery" is not always the #3 tab - so the event should look for the word "Gallery" in the .tabnav class

    Hope this makes sense. thanks a lot in advance.

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,277
    Thanks
    10
    Thanked 581 Times in 562 Posts
    Code:
    $(".tabnav  [href$=#3]").click();
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Posts
    152
    Thanks
    5
    Thanked 0 Times in 0 Posts
    thanks but the Gallery will not always be #3... it could be #4 on some posts..

    so the code needs to search for the word "Gallery" instead..

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Give the anchors an id and reference the link by id.
    $('a #Gallery').click();
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,277
    Thanks
    10
    Thanked 581 Times in 562 Posts
    Quote Originally Posted by neodjandre View Post
    thanks but the Gallery will not always be #3... it could be #4 on some posts..

    so the code needs to search for the word "Gallery" instead..
    my code doesn't use any number, it uses the href of the link, doesn't matter where the link appears...

    you could use the href "#gallery" instead of "#3" if you want more semantec code.

    you should NOT try to find the right element using it's text content; Chrome translates such text and so your script would only function in it's original language if you did that.

    @wolfshade:
    there are no children of the anchors, so i think you must have meant :
    Code:
    $('a#Gallery').click();
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #6
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Space indicates a child node? (rolling eyes) .. still much to learn.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,277
    Thanks
    10
    Thanked 581 Times in 562 Posts
    Quote Originally Posted by WolfShade View Post
    Space indicates a child node? (rolling eyes) .. still much to learn.
    well, actually, space indicates a child Element or pseudo-selector...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #8
    Regular Coder
    Join Date
    Aug 2002
    Posts
    152
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by WolfShade View Post
    Give the anchors an id and reference the link by id.
    $('a #Gallery').click();
    unfortunately i am using a theme and i can't really have the flexibility to do this. but thanks for the help anyway


  •  

    Posting Permissions

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