?
Solved

problem with jQuery removeClass, does not seem to be working

Posted on 2012-03-23
3
Medium Priority
?
899 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

741 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