Radio Button change event not working in chrome or safari
I've got some radio buttons on a page and when Yes is selected, some other controls (dropdowns and textboxes) become visible. If No is selected, they become invisible again. This is working fine in FF & IE. It does work when I use the mouse with chrome, but when I'm tabbing through the page, the controls never become visible. It's as if the change event doesn't trigger because I'm tabbing. Any ideas of what might be causing this, or how I'd go about fixing it?
The show/hide functionality is being done with JQuery.
Edit: Showing the code that is giving probl开发者_开发技巧ems.
$("#rbtnControlYes").change(function () { $("#otherControls").show(); });
Found the answer to this.
Instead of using the .change event, I switched it to .click and everything worked fine.
Hope this helps someone.
Slap
For those not using JQuery, the onClick event is what you want.
It appears that onClick has the behavior of what we intuitively call "select". That is, onClick will capture both click events and tab events that select a radio button. onClick on Chrome
onClick has this behavior across all browsers (I've tested with IE 7-9, FF 3.6, Chrome 10, & Safari 5).
精彩评论