Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Jquery selecting all selectors but not $(this)

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23952
    egalegal
    Member

    Hi,
    what I’m trying here is to select all other "dt" selectors but this one i just clicked.
    My intention is to close all other "dt" tags if another is clicked.
    Opening just works good, but don’t know how i should program jquery that it should close all other "dt" tags.

    thanks a lot for help
    here is the code so far.
    i let getclassname() get the name of the class which every <dt> and <dd> which belong to each other, have in common.

    Code:
    $(document).ready(function(){
    $(“dt”).toggle(
    function(){
    $(getclassname($(this))).slideDown(“slow”);
    },
    function(){
    $(getclassname($(this))).slideUp(“slow”);
    });

    function getclassname (pointer){
    var name = pointer.attr(‘class’);
    var class = “dd.” + name;
    return class;
    }
    });

    #53335
    Rob MacKay
    Participant

    now someone much more clever than I am will come back to you saying something along the lines of "create a CSS class called something like on, then attach it to the this" then you can use an if statement to do whatever you want to thing thing that is on…

    omg that was just rambling… I need to sit down and learn this stuff!

    I know what I mean but I have no idea how to tell you :D

    something like here:

    viewtopic.php?f=5&t=1465

    As long as the jQuery can know which is "on" it can do something with it…

    Im shutting up now :)

    #53346
    egalegal
    Member

    ok i found something to get it work.

    Code:
    $(“dt”).click(
    function(){
    $(this).next(“dd”).slideToggle().siblings(“dd”).slideUp();
    });

    but another question, it flashes/flickers/jump on a click and before it slides down. do you have the same error?
    thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.