Reputation: 44
This is driving me nuts. I am sure it's something easy, but I just can't see it.
I am trying to use twitter bootstrap to open/close a form. Of course, works fine on chrome, but not IE9. I create a simple js fiddle that works in both:
<div class="container">
<div id='s'> this works </div>
<button id='b'>toggle</button>
</div>
$(document).ready(->
$('#s').collapse(toggle: true)
$('#b').click(->
$('#s').collapse('toggle')
)
)
However, when I do (what looks to be exactly the same) in my app, it doesn't work.
$(document).ready(->
$('#phone_call_form').collapse(toggle: true )
$('#addPhone').click(->
$('#phone_call_form').collapse('toggle')
# alert('this holds things up long enough for me to see form is opening and immediately closing')
)
# handlers for the buttons
$('#phone_call_save').click(->
$('#new_phone_call').submit()
$('#phone_call_form').collapse('hide')
)
$('#phone_call_cancel').click(->
$('#phone_call_form').collapse('hide')
)
)
If I add the alert in there, I can see that the form is showing and hiding again immediately.
Using twitter bootstrap 2.3.2 and jQuery 1.9.1. My code is included after bootstrap plugin, etc. EDIT: Never mind. The click event was attached to an icon. It worked when I used a div, though no idea why??
Upvotes: 2
Views: 615