I have this line of code in my ERB file:
<% image_tag("foo.png", :onClick => "do_x('param')") %>
This produces the bad HTML:
<img src="/assets/foo.png" onClick="do_x(param)" />
I've tried using:
<% raw image_tag("foo.png", :onClick => "do_x('param')") %>
But that makes no difference. I'm running Rails 3.2.14.
Try use <%= image_tag("foo.png", :onClick => "do_x('param')".html_safe ) %>
.
Because your string include quotes that will be transferred default :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With