RJS Scripting

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>

sounds like you should be using setStyle (a prototype method) to make your elements bold, e.g.:

element.setStyle({fontWeight: 'bold'})

I'm not sure if there's an RJS wrapper for the setStyle method so I'm not entirely sure this will work as written. Something like this will definitely work though:

page << "$(#{element}).setStyle({fontWeight:'bold'});"

... which is kinda the long way around.

It does not work for some reason.......

I'm not sure this is the code I'm looking for because I've tried every combination of 'element' including #alphabet dd alphabet dd alphabet and none of those elements work to change the div. More importantly, shouldn't this change the entire div? I would like to only change those that match the search results. My index has two arrays for all schools and the search results @search. Is there really just no way to pass this to javascript for ajax? Would that be useful? Is what I'm implementing just too ridiculous?