this is my form:
<%= form_tag('/search/results', :method => "get") do %>
<%= label_tag(:q, "Search for:") %>
<%= text_field_tag(:q) %>
<%= submit_tag("Search") %>
<% end %>
i want when i start typing in the text field the site wil refresh. how can i do it?
If you mean to just add extra HTML attributes to the element generated by text_field_tag
, you can pass them as a hash.
<%= text_field_tag(:q, :onkeyup => 'myJSFunctionToHandleStuff()') %>
Hash arguments other than :disabled
, :size
, :maxlength
, :placeholder
are treated just as passthrough HTML attributes onto the generated input
element
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.