Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6339313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:37:36+00:00 2026-05-24T19:37:36+00:00

this question is fairly straight forward: is it recommended to place a semicolon when

  • 0

this question is fairly straight forward:

is it recommended to place a semicolon when attaching an event handler to a html object?

example 1:

<div onmouseover="functionName()">This is my div</div>

example 2:

<div onmouseover="functionName();">This is my div</div>

which of the above is the most correct?

they both work, but is there a ‘correct’ way of doing this while keeping the event handler in the html?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:37:38+00:00Added an answer on May 24, 2026 at 7:37 pm

    The ‘most correct’ way would be to not put the handler in the HTML attribute at all. Separation of content, presentation and behaviour will result in more easily maintainable code.

    If you decide to put the handler in the HTML attribute, using a semi-colon to terminate the expression would be more correct. Consider the case of calling two functions:

    onclick="someFunc();someOtherFunc();"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a fairly straight forward question but I'm having a problem finding a
This should be a fairly straight forward python question, but I'm getting stuck getting
This seems like it should be fairly straight-forward, but I can't see anything obvious.
I have a question which i suspect is fairly straight forward. I have the
I've created a fairly straight forward page with a check box: @using (Html.BeginForm(MyController, MyAction,
This question is fairly fundamental.I gave a simple and straighfoward test on my cygwin:
While I understand this question is fairly vague since I'm not giving you all
This question may sound fairly elementary, but this is a debate I had with
I'm not a regular C++er, so this question might be fairly trivial: Can anybody
First of all, I'm fairly new to Java, so sorry if this question is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.