HTML onclick attribute

HTML onclick attribute: In this attribute will trigger when the event on the mosue click changes. And this event is similar to the oninput event.

HTML onclick attribute

This attribute will support all parts of the HTML.

Syntax: <element onlick = “script”>

Browser compatibility

This attribute supports different types of browsers as follows

  • Chrome
  • Mozilla
  • InternetExplorer
  • Safari
  • Opera


            onclick event attribute 
            /* If onclick event call then 
            this script will run */ 
            function onclick_event() { 
                    = "Welcome to Freshersnow!"; 
    <body style = "text-align:center"> 
        <!-- onclick event call here -->
        <p id = "freshersnow" onclick = "onclick_event()"> 
            Click Here 


html onclick attribute