Solved

problem with jQuery removeClass, does not seem to be working

Posted on 2012-03-23
3
898 Views
Last Modified: 2012-03-23
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
Comment
Question by:bbdesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Gary Davis earned 500 total points
ID: 37757219
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
 

Author Comment

by:bbdesign
ID: 37757892
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
 

Author Comment

by:bbdesign
ID: 37757898
For some reason, the mouseover doesn't realize the class has been removed.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question