Jquery toggle code only works in IE , but not Chrome/FF
Hi guys, i have some jquery code that shows and hides some content. but it only works in IE but not FF or chrome. Can anyone please help me with that?
- <div class="critical">
- <div class="rec">
- <div class="header">
- <a><img alt="open this item" src="/images/rec.png" /></a>
- <h3>Know your break-even point </h3>
- <a><span class="more">more... </span></a>
- </div>
- <div class="content" style="display: none;">
- <div class="reportIntro">
- <p>You need to understand how to work... </p>
- </div>
- </div>
- </div>
- </div>
- <div class="important">
- <div class="rec">
- <div class="header">
- <a><img alt="open this item" src="/images/rec.png" /></a>
- <h3>Know your break-even point </h3>
- <a><span class="more">more... </span></a>
- </div>
- <div class="content" style="display: none;">
- <div class="reportIntro">
- <p>You need to understand how to live... </p>
- </div>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- jQuery(".header a").click(function()
- {
- if (jQuery.browser.msie && jQuery.browser.version == '6.0') {
- if (jQuery(this).parent().find("img").attr("src") == "Dwn.gif")
- {
- jQuery(this).parent().find("img").attr('src', 'Rgt.gif');
- jQuery(this).parent().find("span").text("more...");
- }
- else
- {
- jQuery(this).parent().find("img").attr('src', 'Dwn.gif');
- jQuery(this).parent().find("span").text("less...");
- }
- }
- else {
- if (jQuery(this).parent().find("img").attr("src") == "Dwn.png")
- {
- jQuery(this).parent().find("img").attr('src', 'Rgt.png');
- jQuery(this).find("span").text("more...");
- }
- else
- {
- jQuery(this).parent().find("img").attr('src', 'Dwn.png');
- jQuery(this).find("span").text("less...");
- }
- }
- jQuery(this).parent().next().animate({ height: "toggle", opacity: "toggle" }, 500);
- });
- </script>
in IE, all the pics/text change fine. the content are toggled as well. but in FF/Chrome the text "more" has been changed to "less" but become unclickable.
Any help will be appreciated.