Hi Only one solution you should use method 'tag' directly https://github.com/rails/rails/blob/39b9c943b7ec5181c19461d319d8c610ea1bf941/actionpack/lib/action_view/helpers/tag_helper.rb#L65
Because escape = true by default for 'text_field_tag' https://github.com/rails/rails/blob/c091fae21f32250b19475f124c3b680dbbc163d9/actionpack/lib/action_view/helpers/form_tag_helper.rb#L170 P.S: Do not use inline JS . On Wednesday, November 14, 2012 7:27:18 PM UTC+2, Ruby-Forum.com User wrote: > > Hi all. > > If In my view I have: > > <%= text_field_tag('name','',:onfocus => "for (var i=1;i<99999;i++){};" > %> > > I'd expect to have this html: > > <input name="name" onfocus="for (var i=1;i<99999;i++){};" /> > > instead I have: > > <input name="name" onfocus="for (var i=1;i<99999;i++){};" /> > > And obviously the javascript code does not work... > > I also tried this: > <%= text_field_tag('name','',:onfocus => "for (var > i=1;i<99999;i++){};".html_safe %> > > but the output is the same > > Thanks to all. > > -- > Posted via http://www.ruby-forum.com/. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/P4jqHCbCiEIJ. For more options, visit https://groups.google.com/groups/opt_out.

