This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I just tried it out, and it seemed to work correctly (with including JQuery the only addition to the file). Are you sure that the code you posted is the code you're running?
From a stylistic point of view, I think it would be much better to add separate event handlers to the two elements, rather than adding the same event handler to each and then having to switch on the ID.
Joined: Apr 06, 2010
Thank you for the advice.And actually the code i was running is a little different,but i figured that couldn't be the cause ,I will go over it again and see what i get...