...

View Full Version : Why wont it work in IE?



sethwb
09-29-2009, 10:05 PM
$(".specialistContainer h5").click(function(){
$(this).parents(".specialistContainer").find(".twistyContent").toggle();
var theSpan = $(this).children('span').text();
if (theSpan == "+") {
$(this).children('span').text("-");
} else {
$(this).children('span').text("+");
}

var theUnderline = $(this).css('text-decoration');
if (theUnderline == "underline") {
$(this).css("text-decoration","underline");
} else {
$(this).css("text-decoration","none");
}

});


...

<div id="oldham0" style="color: black; display:none; margin-bottom: 6px;">
<div class="specialistContainer">
<h5 style="color: #000;">company name</h5>
<div class="twistyContent" style="display: none;">
Unit 3, Coldhurb Ind Estate
<br/>
Coldhurst Street
<br/>
Oldham
<br/>
Lancashire
<br/>
OL1 2BQ
<br/>
0161 624 5555
</div>
<a href="mailto:info@company.com" style="color: #000;font-weight: bold;">info@company.com</a>
<a href="http://www.company.com" target="_blank" alt="company" title="company" style="color: #000;">www.company.com</a>
</div>
</div>


That click listener doesn't get attached no matter what I do! I've confirmed that the other functions work, such as the toggle();, and it ALL works in firefox... what is going on?

sethwb
09-29-2009, 10:50 PM
I found the solution:


live("click", function()


instead of

.click()


will attach my event to all existing and future elements that match the selector.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum