September 20, 2012

Mouse click activity, mousedown, mouseup and click

Mouse click activity

Mouse click activity, mousedown, mouseup and click

Javascript related event handlers like onmousedown, onmouseup and onclick are the subdivisions of an event. These events are triggered by mouse click which is subdivided into the following:

  1. onmousedown
  2. onmouseup
  3. onclick

To understand this activity we have to guess that when we press mouse button “left click” that is mousedown and if there are

  • input radio
  • input checkbox

are using these events so their checked status will behave different on these events. Because radio and checkboxes don’t return the checked status till you complete this click activity on the same object. Like you mousedown on a checkbox and then on the same object you mouseup so you complete an activity which is called a click. So these two objects radio and checkbox clearly differ in subdivisions of click activity. That’s why we ever want to check that either this radio or checkbox is checked or not? So we use onclick instead of onmousedown or onmouseup because incomplete activity returns the wrong status.

Last updated: March 19, 2014