Home > Web Development > Simulating the Click Event on Firefox

Simulating the Click Event on Firefox

August 4th, 2008 R Leave a comment Go to comments
1
2
3
4
5
6
7
8
9
10
11
12
	if(navigator.appName.indexOf("Explorer")== -1)
	{
 
		// Simulates the click() event for gecko based browsers
 
		HTMLElement.prototype.click = function()
		 {
			var evt = this.ownerDocument.createEvent('MouseEvents');
			evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
			this.dispatchEvent(evt);
		 }
	}

Source : Unknown

Drop me a line and I will provide credit :)

Categories: Web Development Tags:
  1. No comments yet.