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

  • SEARCH
  • Home
  • 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 7587589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:42:38+00:00 2026-05-30T19:42:38+00:00

I have a <span> button, which calls some jQuery, I need a way to

  • 0

I have a <span> button, which calls some jQuery, I need a way to then disable it (and if possible, it’s corresponding up/down button) from being repeatedly clicked. I have made event handlers for the buttons as such:

$('.RateDown').click(function() {

    //down counter
    var downValue = parseInt($(this).text());
    downValue--;
    $(this).text(downValue);

    //total counter
    var totalValueElement = $(this).prevAll('.RateTotal').first();
    var totalValue = parseInt(totalValueElement.text());
    totalValue--;
    totalValueElement.text(totalValue);
});

(And a similar one for RateUp)

And the relevant HTML as follows

<div class='RateBar'>
    <span class='RateTotal'>0</span><br />
    <span class='RateUp'> +0</span>
    <span class='RateDown'> -0</span>
</div>

This works for the moment, but anyone can repeatedly spam the button, so I was thinking that if I change it’s class to a “Rated” one, that it would not be click-able. I have tried using the .attr() feature, but this does not succeed. Is it possible to disable it in this way, or some other way? I have played around with a disabled boolean, changing it on click, but with multiple buttons on a page, this is impractical.

(The buttons are currently here)

  • 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-30T19:42:39+00:00Added an answer on May 30, 2026 at 7:42 pm

    Use jQuery .one on the click event – it binds only once. – http://api.jquery.com/one/

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

Sidebar

Related Questions

I have some PHP code which runs a loop, spitting out a button and
I have a form which is in an updatePanel and I have a span
I have a button which needs to run a javascript function when clicked. The
I have this group of radio buttons in which each of individual button has
Suppose i have the following html: <button class=inforTextButton idmyButton> <span class=leftSlice></span> <span class=centerSlice>Approved</span> <span
I have a page on which I'm using jQuery UI Tabs , what I'm
I need to have a single <li> element which has two buttons inside of
I have a repeater and each item contains a button which should redirect to
I have a minor problem, basically I have a hidden input button which is
I have a submit button which is simply marked up as this: <input type='submit'

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.