Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Senior Member
    Join Date
    Sep 2015
    Posts
    251

    What Is Onclick In HTML?

    Hello friends,

    What Is Onclick In HTML?

  2. #2
    Registered User
    Join Date
    Nov 2019
    Location
    INDIA
    Posts
    34
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.
    It executes a JavaScript when a button is clicked.

    Syntax:
    <button onclick="myFunction()">Click me</button>
    TuxAndrew
    Linux - RedHat,cPANEL CentOS,Ubuntu,Azure/AWS Administrator,
    Assistance, Analysis and Diagnosis. Skype: tuxandrew
    tuxandrew@aol.com

  3. #3
    Registered User
    Join Date
    Nov 2019
    Posts
    2,528
    OnClick is an attribute of a Button or Picture object. It contains an expression that gets evaluated when you click the button or picture. ... This means, for example, that the OnClick expression can do different things depending on which part of an image you click.

  4. #4
    Registered User
    Join Date
    Dec 2018
    Posts
    544
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.

  5. #5

  6. #6
    Senior Member
    Join Date
    Aug 2019
    Location
    6690 Roswell Rd #540, Sandy Springs, GA 30328
    Posts
    181
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.
    Last edited by rickylarson; 12-09-2019 at 02:07 AM.

  7. #7
    Registered User
    Join Date
    Nov 2019
    Posts
    2,528
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.

    How it works:
    The onclick JavaScript event occurs when the user clicks on an element. It runs a specified line of code when you click a HTML object that has the onclick attribute. The JavaScript onclick functions can be triggered by object.onclick or object.addEventListener

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Location
    Forum
    Posts
    5,019
    The onclick attribute is an event attribute supported by all browsers. It appears when a user clicks on a button element. If you want to make a button onclick, you need to add the onclick event attribute to the <button> element. The button onclick runs a script when a button is clicked.
    Cheap VPS | $1 VPS Hosting
    Windows VPS Hosting | Windows with Remote Desktop
    Cheap Dedicated Server | Free IPMI Setup

  9. #9
    Senior Member
    Join Date
    Nov 2018
    Posts
    1,853
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.

  10. #10
    Registered User
    Join Date
    Nov 2019
    Posts
    90
    The onclick JavaScript event occurs when the user clicks on an element. It runs a specified line of code when you click a HTML object that has the onclick attribute. The JavaScript onclick functions can be triggered by object.onclick or object.addEventListener .

  11. #11
    Senior Member
    Join Date
    Dec 2019
    Posts
    1,837
    An on-click event is one of the mouse events, which occurs during mousedown and mouseup events. i.e From your mouse u did a right click towards downward and then u released it at that stage this event will occur. alert(Onclick event happened!)

  12. #12
    Registered User
    Join Date
    Mar 2019
    Location
    Ahmedabad
    Posts
    180
    The Onclick event pass on button when button click and generate the event.You need to add the event inside a <button> tag.
    In Html
    Code:
    <button onclick="clickOn()">Submit</button>

  13. #13
    Senior Member
    Join Date
    Dec 2019
    Posts
    1,837
    An on-click event is one of the mouse events, which occurs during mousedown and mouseup events. i.e From your mouse u did a right click towards downward and then u released it at that stage this event will occur. alert("Onclick event happened!")

  14. #14
    Senior Member
    Join Date
    Dec 2019
    Posts
    1,837
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.

  15. #15
    Senior Member
    Join Date
    Mar 2020
    Posts
    1,214
    The onClick attribute is an event handler that instructs the browser to run a script when the visitor clicks a button.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.