can anyone spot a problem with this code...when a user clicks on the
element with an id of chatButton it should toggle the element with an
id of comment_box...but it doesn't. I have display: none set inline on
the comment_box.....if i put an alert in where ive put the commented
out alert("hello") in the code below what happens is the when i click
the alert hello shows then when i click that the comment_box shows
then the alert shows again and the comment box gets hidden?!?!?! Its
like the toggle runs twice in one function....any ideas of what ive
got wrong because i cannot spot it?
document.observe('dom:loaded', function() {
var chatButton = $('chatButton');
var comments = $('comment_box');
chatButton.observe('click', function(event){
//alert("hello");
alert("hdfghfg");
comments.toggle();
})
})
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---