The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Incrementing buttons duplicates

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #145363


    I am trying to use the “Add (+/-) Button Number Incrementers” for a web page. The example has +/- both to the right but I’m trying to split them on each side of the number field.
    Unfortunately it’s not working. Both buttons are being duplicated and one of them even adds/reduces by 2 instead of 1.
    I have managed to hide the double รท but the double + is still visible.
    Any help would be appreciated.
    Link to page


    Here is the css:
    .numbers-row {
    .buybutton {
    margin: 5px 0 0 5px;
    padding: 0;
    text-indent: -9999px;
    cursor: pointer;
    height: 20px;
    float: left;
    position: relative;
    text-align: center;
    background: url(../images/icons/pluss-minus.png) no-repeat;
    .inc {
    left: -80px;
    background-position: 0px -20px;
    .dec {
    left: -108px;
    background-position: 0px 0px;

    and this is the jQuery:

     $(function() {
      $(".numbers-row").append('<div class="buybutton dec">-</div><div class="buybutton inc">+</div>');
      $(".buybutton").on("click", function() {
        var $button = $(this);
        var oldValue = $button.parent().find("input").val();
        if ($button.text() == "+") {
          var newVal = parseFloat(oldValue) + 1;
        } else {
           // Don't allow decrementing below zero
          if (oldValue > 0) {
            var newVal = parseFloat(oldValue) - 1;
            } else {
            newVal = 0;

    You have the jQuery code in your file incrementing.js and that file is being loaded twice, thus it is running twice. View the source of the page, you will see two lines like:

    <script src=""></script>

    It looks like other JavaScript is also showing up twice. I’m not sure what is powering your site, but the theme needs to be fixed so that it only inserts JavaScript once.


    Hi Chris,

    Thank you!
    It was my mistake. I probably copied the line with the script when I was duplicating a trigger for a popup.
    Thanks for pointing out the other double scripts as well:-)

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.