How to hide / show a button in jQuery

Discussion in 'jQuery' started by TheNewWorld, May 28, 2017.

Thread Status:
Not open for further replies.
  1. #1
    I have a form and three buttons on the bottom, lets say A, B, and C. When I click on A it needs to disappear and the B and C need to be the only ones that are shown. After clicking on either B or C, the button A needs to reappear again. jQuery is what I need to use.
     
    TheNewWorld, May 28, 2017 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Last edited: May 28, 2017
    PoPSiCLe, May 28, 2017 IP
  3. TheNewWorld

    TheNewWorld Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    A, B, C. When you click on A, it disappears and only B and C are active. When you click on any of these two (B or C), the A appears again. It should not be a matter of how many buttons are active at a time. When A is clicked it needs to disappear, and when it is not on a page, it needs to show up again only after the B or C is clicked.
     
    TheNewWorld, May 28, 2017 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Yes, as I said - radiobuttons, look at the example.
     
    PoPSiCLe, May 28, 2017 IP
  5. TheNewWorld

    TheNewWorld Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    I need to do it this way.
     
    TheNewWorld, May 28, 2017 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Why? And what is "this way"? Using jQuery? Why do you need to do it a way that is not beneficial for either you nor the user of the page?

    But the solution is simple (same HTML, almost the same CSS): https://jsfiddle.net/dfvy4sgw/1/ (with jQuery this time)
     
    PoPSiCLe, May 28, 2017 IP
  7. TheNewWorld

    TheNewWorld Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    Thanks for looking into that. It does not work 100% as what is needed though. Initially: buttons A, B, C. When you click on A, it disappears and B and C are present. When B and C are present, after clicking on any of them it goes back to the A, B, and C state (three buttons present).
     
    TheNewWorld, May 28, 2017 IP
  8. TheNewWorld

    TheNewWorld Greenhorn

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #8
    I already have an answer so this topic can be closed.
     
    TheNewWorld, May 28, 2017 IP
Thread Status:
Not open for further replies.