Add link to a Button

19 Dec 20221 minute to read

The appearance of the Button can be changed like a hyperlink by e-link class using cssClass property and link navigation can be handled in Button click event.

In the following example, link is added in Button click event by using window.open() method.

<ejs-button id="button" cssClass='e-link' content="Go to Google"></ejs-button>

<style>

    button {
        margin: 25px 5px 20px 20px;
    }
</style>

<script>

    document.getElementById('button').onclick = function() {
        window.open("https://www.google.com");
    };

</script>

NOTE

View Sample in GitHub.