Activity Forums Salesforce® Discussions How to Perform show/hide toggle using JavaScript on a salesforce visualforce page?

  • Kumar

    Member
    January 19, 2017 at 2:14 pm

    Hi Sushant,

    You will have to implement this by changing the style for each part of your page that you wish to hide and show. Something like:

    <button onclick="myFunction()">Try it</button>

    <div id="myDIV">
    This is my DIV element.
    </div>

    <script>
    function myFunction() {
    var x = document.getElementById('myDIV');
    if (x.style.display === 'none') {
    x.style.display = 'block';
    } else {
    x.style.display = 'none';
    }
    }
    </script>

  • sushant

    Member
    January 23, 2017 at 8:05 am

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos