Help me .hide() the div!

here is my code:

<input id=‘the_input’ type=‘text’ />

<%= 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?

try using Element.hide(‘the_result’)

Nanyang Z. wrote:

here is my code:

<input id=‘the_input’ type=‘text’ />

<%= observe_field(:the_input,
:frequency => 0.5,
:update => ‘the_result’,
#…
)%>
<%= link_to_function(‘the link’, “$(‘the_input’).value=‘new
value’;$(‘the_result’).hide( );”)

Steven Albarracin wrote:

try using Element.hide(‘the_result’)

where to put it?

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 Z. wrote:

Steven Albarracin wrote:

try using Element.hide(‘the_result’)

where to put it?

Steven Albarracin wrote:

Not sure what your question is

I 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.