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 7082091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:00:12+00:00 2026-05-28T07:00:12+00:00

I have 2 buttons which are both displayed twice like below: Button 1 (Performs

  • 0

I have 2 buttons which are both displayed twice like below:

Button 1 (Performs the onclick='SelectAll(this)')
Button 1 (Performs the onclick='RemoveAll(this)')

Button 2 (Performs the onclick='SelectAll(this)')
Button 2 (Performs the onclick='RemoveAll(this)')

Both Button 1 and Button 2 should appear once like below:

Button 1 (Performs the onclick='SelectAll(this)')
Button 2 (Performs the onclick='RemoveAll(this)')

How can I achieve this above:

The code which displays these buttons are below:

function insertButton(form) {   


var $answer = $("<table class='answer'></table>");

$('.buttonOne:first, .buttonTwo:first').each(function() {
        var $this = $(this);
        var $BtnsClass = '';

        $row = $("<tr/>").appendTo($answer);
        $cell = $("<td/>").appendTo($row);


        $BtnsClass = $("<input class='buttonOne btnsAll' type='button' style='display: block;' value='Button 1' onClick='selectAll(this);' />
        <br/>
        <input class='buttonTwo btnsRemove' type='button' style='display: block;' value='Button 2' onClick='removeAll(this);' />")
        .attr('name', $this.attr('name')).attr('value', $this.val()).attr('class', $this.attr('class'));

        $BtnsClass.appendTo($cell);

    });  

        $tr.append($answer);

        }   

Below is the html where the buttons in the jquery should match to

<p><input class="buttonOne btnsAll" name="allBtnsName" type="button" value="Button 1" onClick="selectAll(this);" />
<br/><input class="buttonTwo btnsRemove" name="allRemoveBtnsName" type="button" value="Button 2" onClick="removeAll(this);" /></p>

The html buttons only display each button once which is fine, so why is the jquery displaying the buttons twice and not once?

  • 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-28T07:00:13+00:00Added an answer on May 28, 2026 at 7:00 am

    I think you are looking for some functionality like below,

    function insertButton(form) {   
    
        var $answer = $("<table class='answer'></table>");
    
        var $btnOne = $('.buttonOne:first');
        var $btnTwo = $('.buttonTwo:first');
    
        var $BtnsClass = '';
    
        $row = $("<tr/>").appendTo($answer);
        $cell = $("<td/>").appendTo($row);
    
        $BtnsClass = $("<input class='buttonOne btnsAll' type='button' style='display: block;' value='Button 1' onClick='selectAll(this);' />
            <br/>
            <input class='buttonTwo btnsRemove' type='button' style='display: block;' value='Button 2' onClick='removeAll(this);' />");
    
        $BtnsClass.attr('name', $btnOne.attr('name')).attr('value', $btnOne.val()).attr('class', $btnOne.attr('class')).appendTo($cell);
    
        $BtnsClass.attr('name', $btnTwo.attr('name')).attr('value', $btnTwo.val()).attr('class', $btnTwo.attr('class')).appendTo($cell);
    
        $tr.append($answer);
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an increase button and a decrease button, both of which affect a
I have a form with a few buttons which execute code when pressed like
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons
I have a webview containing a form which has both send and cancel buttons.
I have two UIAlertView's which are not displayed one after another. Both of the
I have a form in which several buttons are added at runtime via a
I want to double buffer a custom control which contains buttons. I have tried
I have WPF Form which has many buttons with the same code. Appearance of
I have a row of buttons, which all create a pdf file which I
I have a JPanel subclass on which I add buttons, labels, tables, etc. To

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.