Escaping single quotes in a javascript literal string
When you need to include multiple nested single quotes within a string of javascript to be executed, escape single quotes with a back slash as needed.
Example from within an .rhtml template
In this example, Double backslashes are required since the blackslash itself needs to be escaped and included within the string of js to be executed by windown.setTimeout().
Example from within an .rhtml template
hide_warning = "window.setTimeout('Effect.BlindUp($(\\'flash_box\\'), {duration:.3})', #{@warning_timeout ||= 8000})"
In this example, Double backslashes are required since the blackslash itself needs to be escaped and included within the string of js to be executed by windown.setTimeout().