The following works in all browsers except IE 9.0.8. It loads a survey form within div with an ajax request.
$('.tab-content').on('click', '.show_survey_form', function(e) {
e.preventDefault()
target = $(this).attr("data-target")
my_href = $(this).attr("href")
console.log("load: " + target + " target: " + my_href)
// load: #survey_response_form_33 target: /surveys/33/survey_responses/edit_multiple
// Don't make a request unless the form is opening.
if ($(this).hasClass('collapsed')) {
console.log("Making request!")
//$(target).load(my_href)
$(this).html(closeSurveyForm) // Just changes the language on the button
} else {
$(this).html(respondToSurvey) // Just changes the language on the button
}
}
The .load is commented out during debugging. IE seems to have a problem using .hasClass in this context. It's used elsewhere with no issue.
The really odd part is that the moment I open the dev tools window, it starts working. It consistently doesn't work before then, and consistently works after hitting F12.
Other issues have said the hasClass method doesn't work when the class contains a \r char but that isn't the case here. I'm using jQuery 1.8.3.
Update: Changing the href to "#" and writing the URL into data-load had no effect. Still works in all browsers except IE 9.0.8.