Forums

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

Home Forums JavaScript simple jquery. why won’t it work?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37170
    shamai
    Member

    I have a definition list and I was just practicing with query. I want to hide the dd’s unless its hovered on

    $(document).ready(function() {

    $(‘dt’).on(‘mouseenter’, function() {
    $(‘this’).next().show().siblings(‘dd’).hide(); //hide all except the dd right underneath the dt

    });
    });

    #99170
    Senff
    Participant

    The elements are hidden (ie. they are not there), so you can’t hover over them, so they will never unhide.

    At least, that’s the case when something is made hidden using display:none; (it’s actually taken out of the flow, so basically they don’t exist).
    You’ll have to hide them with the visibility:hidden; property to start with, then they are there but just invisible.

    #99172
    shamai
    Member

    no the dd is hidden the dt is not
    its my syntax… somethings wrong…

    #99178
    Mottie
    Member

    Maybe it’s that $('this') should be $(this) with no quotes.

    #99179
    mcguiver178
    Member

    are you trying to make a hover where you highlight only the one that’s mousedover?

    #99180
    shamai
    Member

    lol the first line $(‘this’) should be $(this)

    im a moron

    i just realized as you posted mottie.

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