here is my code: <input id=''the_input'' type=''text'' /> <div id=''the_result''></div> <%= observe_field(:the_input, :frequency => 0.5, :update => ''the_result'', #... )%> <%= link_to_function(''the link'', "$(''the_input'').value=''new value'';$(''the_result'').hide( );") When a user click the link, the_input''s value will be updated, which fires the observer, then the_result div will be showed, and it''s bad, because I intend to hide the div, if the_input''s value is changed not by typing in the input filed, but by clicking the link, and that''s why I added "$(''the_result'').hide( );" to link_to_function. but now this .hide() is useless... So how can I correct it? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try using Element.hide(''the_result'') Nanyang Zhan wrote:> here is my code: > > <input id=''the_input'' type=''text'' /> > <div id=''the_result''></div> > > <%= observe_field(:the_input, > :frequency => 0.5, > :update => ''the_result'', > #... > )%> > <%= link_to_function(''the link'', "$(''the_input'').value=''new > value'';$(''the_result'').hide( );") >-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Steven Albarracin wrote:> try using Element.hide(''the_result'')where to put it? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Not sure what your question is anymore but if its to create a link that shows and hides a div <%=link_to_function("the link", nil,:onclick => "Element.toggle(''the_result'')")%> Nanyang Zhan wrote:> Steven Albarracin wrote: >> try using Element.hide(''the_result'') > > where to put it?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Steven Albarracin wrote:> Not sure what your question isI know Element.hide(''the_result'') or $(''the_result'').hide( ) will hide a div, but my problem is: the link, which intend to hide the div, trigger an observer, and this observer make the div show again. I don''t know how to turn off the observer when the link is clicked. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---