locked
Hide all button Except one RRS feed

  • Question

  • User2062956768 posted

    friends

    How I can Hide all button on the page except only one i don't want to hide

    using Jquery or Javascript

    Thank you

    Friday, July 19, 2019 9:28 PM

All replies

  • User-2054057000 posted

    You need to understand jQuery working first in order to make these simple codes. I give you this code:

    $("#button1").hide(); // hides the button with id 'button1'
    
    $("#button2").show(); // displays the button with id 'button2'
    

    jQuery is quite easy. Just read some tutorials for 1 hour and you will start making codes by yourself.

    Saturday, July 20, 2019 11:53 AM
  • User839733648 posted

    Hi mrzoz,

    You may use .not() and .hide() event.

    $("button").not("#not-want-buttonID").hide();

    or

    $("input[type='button']").not("#not-want-buttonID").hide();

    Here is a simple demo.

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title></title>
        <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <script>
            $(function () {
                $("input[type='button']").not("#button3").hide();
                $("button").not("#button4").hide();
            })
        </script>
    </head>
    <body>
        <input type="button" id="button1" value="button1" />
        <input type="button" id="button2" value="button2" />
        <input type="button" id="button3" value="button3" />
        <button id="button4">button4</button>
        <button id="button5">button5</button>
        <button id="button6">button6</button>
    </body>
    </html>

    result:

    Best Regards,

    Jenifer

    Monday, July 22, 2019 2:09 AM
  • User-1151440187 posted
    $("#hideButton").hide(); // hides the button with id 'hideButton'
    
    
    Monday, July 29, 2019 4:18 AM