simple javascript

Hi,

<div onclick="document.search.search_field.value='';">....</div>

  <form id="search">
...
<%= text_field_tag :search, params[:search], :id=>"search_field",
:value=>params[:search] %>
...

Just wondering how I would clear the value for the text_field_tag,

Thanks!!

Justin To wrote:

Hi,

<div onclick="document.search.search_field.value='';">....</div>

  <form id="search">
...
<%= text_field_tag :search, params[:search], :id=>"search_field",
:value=>params[:search] %>
...

Just wondering how I would clear the value for the text_field_tag,

Thanks!!

if you were using a form_remote_tag you could always say :complete =>
'document.getElementById("search_field").value = ""'

<% form_remote_tag update => "id_of_div_to_update", :url => { :action =>
:method_call}, :complete=>
'document.getElementById("search_field").value = ""' do -%>

.....

<% end ->