- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
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?
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
});
});
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.
no the dd is hidden the dt is not
its my syntax… somethings wrong…
Maybe it’s that $('this')
should be $(this)
with no quotes.
are you trying to make a hover where you highlight only the one that’s mousedover?
lol the first line $(‘this’) should be $(this)
im a moron
i just realized as you posted mottie.