Bug Tracker

Opened 14 years ago

Closed 13 years ago

Last modified 11 years ago

#6192 closed bug (invalid)

event.srcElement is incorrect when calling jquery.change() from within a click handler

Reported by: bpstoxin Owned by:
Priority: undecided Milestone: 1.4.3
Component: event Version: 1.3.2
Keywords: .Net ValidatorOnChange event change click Cc:
Blocked by: Blocking:


I am currently using .Net and I am getting an error in the ValidatorOnChange() method because .Net attempts to use the event.srcElement property to determine which validators to use.

I have tracked down the issue and it results because in a jQuery.click() handler I have to change the value of another control and call jQuery.change() for that control. This causes the event.srcElement to point to the control in which the click event was triggered for.

I have attached a scaled down example which demonstrates the problem without the need of .Net. You will notice that it works correctly in browsers other than IE so long as you pass event as an argument to the onchange handler. I am not sure if .Net does this or not.

Attachments (1)

jQueryBug.htm (710 bytes) - added by bpstoxin 14 years ago.

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by bpstoxin

Attachment: jQueryBug.htm added

comment:1 Changed 13 years ago by snover

Priority: undecided
Resolution: invalid
Status: newclosed

If you bypass jQuery’s event handling system, as you are doing here, do not expect things to work properly.

comment:2 Changed 13 years ago by mkubarycz@…

I don't think the example "bypass jQuery’s event handling system". I am pretty sure he was just trying to use the event handling system. This feature would have been usefull (if it worked in IE).

Looks like someone didn't want to fix this bug. Must be nice.

comment:3 Changed 12 years ago by rogi1

hmm... also Asp.Net eventhandler bypass your event handling system, the "ValidatorOnChange" event throws an exception in couse of an manually invoked change event.

comment:4 Changed 11 years ago by ivanfrank@…

The problem is with IE and the window.event object being null; it has nothing to do with jQuery. Any time you call, for example, the onchange() of a select box that has a Validator bound to it, you will get an error in IE 8- because of the window.event being null.

Note: See TracTickets for help on using tickets.