button_to_function with text and image

Hi,

Is there a way to have text as well as image u the button_to_function.
<%= button_to_function "Cancel" , "#{remote_function()}"%>

I have something like this and now i want the cancel should also have
some text with it.

Neha

http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M001062
113: def button_to_function(name, *args, &block)
114: html_options = args.extract_options!
115: function = args[0] || ''
116:
117: html_options.symbolize_keys!
118: function = update_page(&block) if block_given?
119: tag(:input, html_options.merge({
120: :type => "button", :value => name,
121: :onclick => (html_options[:onclick] ?
"#{html_options[:onclick]}; " : "") + "#{function};"
122: }))
123: end
See the source.
Although I am not quite understand it, I am sure that the only way
with which you can do this is using javascript in 'onclick' event, if
there does exist a way.
But if you want text and image before click, I think you'd better
write html on your own.

yeah thats the approach i had to follow
:slight_smile: