Posts Tagged ‘javascript’
WebDesignerWall has a great introductory jQuery tutorial. There are ten tutorials, including ones on animated hover effects, collapsible panels and menu accordions.
I was using the Rails helper observe_field to monitor a text entry form on my web app. I couldn’t figure out why the relevant method was not being called until I realized that it was happening every time there was a single quote in the text entry. The solution is simple. Use the escape_javascript function as shown below:
 [ruby]
<%= observe_field :guess,
:frequency	=> 0.5,
:update		=> 'ajaxWrapper',
:url		=> {:action => 'feedback', :only_path => false},
:with		=> "'correct=#{escape_javascript(@text)}&guess='+encodeURIComponent(value)" %>
[/ruby]