Katyal
Katyal

Reputation: 409

rails: how to have an image for the submit tag?

I have been using submit tag helpers.

<%= submit_tag 'Submit' %>

I have an image called my_image.png.

How can I make the submit button be an image?

I tried:

    <%= submit_tag '#{image_tag("Login_small.png", :width=>70)}' %>

But that doesn't work..

Upvotes: 22

Views: 11980

Answers (2)

Rob Di Marco
Rob Di Marco

Reputation: 45002

Check out image_submit_tag, it is what you are looking for. It is used like image_submit_tag("login.png")

Upvotes: 44

JAL
JAL

Reputation: 21563

I believe you'd like to use image_submit_tag.

See the docs for more details.

Upvotes: 3

Related Questions