Inline javascript in partials

When rendering the following partial, the

<% onclick ||= click_fn %>

<%= image_tag("/images/tfs/en-#{button}.png", {
:onclick => onclick,
:name => “submit_#{button}”,
:width => “32px”,
:height => “32px”,
:onmouseover => “setStatusMessage(’#{button} files’);”,
:onmouseout => “setStatusMessage(’’);”
}) %>

Is the script code stripped out from the HTML output? Or are you doing
this via ajax?

afaik, inline javascript isn’t executed if you’re replacing innerHTML
with content pulled via ajax.

oh - yes, that would be it, then. oddly enough, i don’t need it any
more because “onclick = if() { }” is working now! i have no idea why
it wasn’t earlier, and was tearing my hair out trying to find a
workaround for it.

martin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs