I'm trying to create a search on the index page where it will take a search input and return to the same page. On this page is a list of all the search items. So I want to highlight them all with AJAX and then leave then in bold permanently. The problem comes in evaluating the school and search term. I really have no idea what I'm doing with this.
page.select("#alphabet strong").each do |element| element.visual_effect :highlight if @search.include? school element.insert_html *make bold* end
<h3>Search <span>schools</span></h3> <% form_remote_tag :url => { :action => 'result' } do %> <p> <%= text_field_tag :search, params[:search] %> <%= submit_tag "Search", :name => nil %> </p> <% end %>
<div id="results"> </div>
<h3>Listing <span>Schools</span></h3> <div id="alphabet"> <% 'a'.upto 'z' do |l| %> <%= l %> <% for school in @schools %> <% if school.title.first == l.upcase %> <strong><%= link_to h (school.title), new_school_course_path(school) %></strong> <% end %> <% end %> <br /> <% end %> </div>