Cetanu Posted May 21, 2010 Share Posted May 21, 2010 Okay, so. $('#head li').mouseenter(function(){ var name = $(this).html(); $('#bubble.'+name+'').show(); }); $('#head li').mouseout(function(){ $('#bubble').hide(); }); I'm trying to make the element whose class MATCHES the <li> class appear when the <li> is moused over. In that code, NAME is the variable that stores the information that matches up to the class... ...but I can't make the element appear! I know the variable is correct, so why doesn't the #bubble whose class = <li>'s information appear? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/202545-utilizing-variable-jquery/ Share on other sites More sharing options...
Maq Posted May 21, 2010 Share Posted May 21, 2010 I'm not quite sure why you're using .html(). If you want the class of the clicked 'li' element, then use: var name = $(this).attr("class"); Quote Link to comment https://forums.phpfreaks.com/topic/202545-utilizing-variable-jquery/#findComment-1061805 Share on other sites More sharing options...
Cetanu Posted May 22, 2010 Author Share Posted May 22, 2010 Oh, because I wasn't matching classes, I was matching the content of the <li> to the name of a class. I.e., <li>Bio</li> matches class="bio". Quote Link to comment https://forums.phpfreaks.com/topic/202545-utilizing-variable-jquery/#findComment-1061832 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.