• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 905
  • Last Modified:

problem with jQuery removeClass, does not seem to be working

On this page:

http://www.stoneridgeretirement.com/v3/independent-living.asp

In the main navigation, the first button labeled Independent Living has a class of "bt" which is what swaps out the image for the mouseover effect. However, on that page I don't want the mouseover effect on that button because you are "on" that page. So I have this on that page:

<script language="javascript" type="text/javascript">
      $(function(){
            $('#home2').css('width','980px');
            $('#home2').css('padding','0px');
            $('#home1').html('<img src="art/gr_independent-living.jpg" width="980" height="356" border="0" alt="Redefining Retirement" />');
            $('#home2').html('<img src="art/gr_independent-living.jpg" width="980" height="356" border="0" alt="Redefining Retirement" />');
            $('#mainnav2').attr('src','art/bt_7b.jpg');
            $('#mainnav2').removeClass('bt');
      });
</script>

Where I have removeClass('bt') I was hoping that would eliminate the mouseover, however it does not. I am having trouble figuring out if the class is being removed, or if there is some other problem. Would appreciate another set of eyes.

Thank you!
0
bbdesign
Asked:
bbdesign
  • 2
1 Solution
 
Gary DavisDir Internet SvcsCommented:
I displayed your page in IE9, clicked F12, did a search for mainnav2 and saw this:

<img id="mainnav2" class="mainnav" border="0" alt="Independent Living" src="art/bt_7.jpg" width="147" height="65">

So it looks like the "bt" class is being removed by your jquery.

The IE devtools are also useful for script debugging to set breakpoints like in the code that removes the class (which seems to be working).

The mouseover issue is another problem.

Gary Davis
0
 
bbdesignAuthor Commented:
Thanks for looking. I ended up have to do a check in my mouseover function, to verify that it actually has the "bt" class before doing anything.
0
 
bbdesignAuthor Commented:
For some reason, the mouseover doesn't realize the class has been removed.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now