Activity Forums Salesforce® Discussions How can i call Javascript function from command button in salesforce visualforce page?

  • Manpreet

    Member
    April 19, 2017 at 1:23 pm

    Hi Suraj,

    This works just fine. (Without the return false; after the alert, the page refreshes)

    <apex:commandButton value="Alert Me" onclick="test(); return false;" />
    <script>
    function test(){
    alert('Got it');
    }
    </script>

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos