Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6695689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:15:07+00:00 2026-05-26T06:15:07+00:00

How do I go about making this button disappear after a user submits the

  • 0

How do I go about making this button disappear after a user submits the vote?

      <p id="button_<%= review.id %>"><%= f.submit "vote" %></p>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:15:08+00:00Added an answer on May 26, 2026 at 6:15 am

    I’d disable the button instead of hiding; creates a less confusing interface.

    You can do this most easily by just adding an onclick attribute:

    <p id="button_<%= review.id %>" onclick="this.disabled=true;"><%= f.submit "vote" %></p>
    

    But if you want to hide it, you can use this.style.display='none'; instead. (If I can remember vanilla JS)

    If you’re already using jQuery though (or are going to be doing a lot of stuff like this):

    $('#button_<%= review.id %>').click(function() {
        $(this).remove(); // or $(this).hide();
    }
    

    edit: this shows the difference between Dr.Dredel’s and my solution


    onsubmit version to make RobG happy (you have to put it on the <form>)

    <form ... onsubmit="document.getElementById('button_<%= review.id %>').disabled=true;">
    

    He’s right that it makes more sense to do it onsubmit; there are other ways to submit a form such as by pressing enter. Presumably you would still want to button to get disabled in such scenarios (which if I’m not mistaken will also prevent you from submitting twice via enter)

    edit: why yes, it does http://jsfiddle.net/mnbayazit/9Snna/2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not talking about making portable code. This is more a question of distribution.
I'm thinking about making a networked game. I'm a little new to this, and
How would a go about making a program where the user enters a string,
I've found posts about making a click event with jQuery for a button, however
I am making a button that looks like this: <!-- Container --> <div> <!--
I'm following this tutorial about making an Ajax request on Rails: http://net.tutsplus.com/tutorials/javascript-ajax/using-unobtrusive-javascript-and-ajax-with-rails-3/ made _form
I am thinking about making a website with some fairly intense JavaScript/canvas usage and
How do I go about making an image or section of the page full
How can I go about making my routes recognise an optional prefix parameter as
I was thinking about making something like Linq for Lua, and I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.