Craig Hopson Posted June 18, 2012 Share Posted June 18, 2012 (edited) hi guys i cant get this working am i missing something simple? <script src="js/jquery-1.7.2.min.js"></script><script type="text/javascript">$('.show-element', '.Item').hover(function() { var container = $(this).attr("id").replace('show_', 'info_'); $('#' + container).show();}, function() { var container = $(this).attr("id").replace('show_', 'info_'); $('#' + container).fadeOut(200);});</script><style>.hidden{ display: none;}</style><div class='Item'> <div class='show-element' id='show_1'>Show</div> <div id="info_1" class="hidden">some stuff</div> <div class='show-element' id='show_2'>Show</div> <div id="info_2" class="hidden">some stuff</div></div> (does not show on hover) Edited June 18, 2012 by Craig Hopson Link to comment Share on other sites More sharing options...
justsomeguy Posted June 18, 2012 Share Posted June 18, 2012 You either need to run that code when the body is finished loading, or place it after the elements that it is supposed to change. The elements don't exist when the code runs right now. Link to comment Share on other sites More sharing options...
Craig Hopson Posted June 18, 2012 Author Share Posted June 18, 2012 So simple THANKS!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now