Using jQuery to hide divs; this isn't working at all for me.
Well, this is my first post and my first impass with jQuery. So far I have been able to figure everything else out myself, but this has perplexed me.
I have a website that I am trying to keep minimal and I am relying on jQuery to change the content in a div that represents the content of the site.
so I have this that makes up the menu system.
- $(document).ready(function(){
-
- $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
-
- $("ul.topnav li a").hover(function() { //When trigger is clicked...
-
- //Following events are applied to the subnav itself (moving subnav up and down)
- $(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
-
- $(this).parent().hover(function() {
- }, function(){
- $(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
- });
-
- //Following events are applied to the trigger (Hover events for the trigger)
- }).hover(function() {
- $(this).addClass("subhover"); //On hover over, add class "subhover"
- }, function(){ //On Hover Out
- $(this).removeClass("subhover"); //On hover out, remove class "subhover"
- })(this).hover(function() {
- $("ul.topnav li span").addClass("subhover");
-
- });
-
- });
Then I have all the page's CSS. etc... A little father down I have a section that I have a particular div in that I want to be able to change; particularly this one. (mylogop)
- <div class="content">
- <div id="mylogop">
- FooBar Foo Bar Foo Content will be here somday
- </div>
so I have this code as well to do that.
- <script type="text/javascript">
- $("#mylogos").click(function() {
- $("#mylogop").replaceAll(FoobarContentHere);
- });
- </script>
It's made so when I click a menu item it switches the HTML with the page appropriate material, but when I click it nothing happens. So maybe there is somthing I am missing, but I am stumped so...Please help!
Thanks,
A.Scales