I have several radio stations on my page, and I want to do something when the checked radio changes, however the code does not work in IE:
$('input:radio').change(...);
And after googling, people suggest using click . But that does not work.
This is a sample code:
<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript"> $('document').ready( function(){ $('input:radio').click( function(){ alert('changed'); } ); } ); </script> </head> <body> <input type="radio" name="testGroup" id="test1" />test1<br/> <input type="radio" name="testGroup" id="test2" />test2<br/> <input type="radio" name="testGroup" id="test3" />test3</br> </body> </html>
It also does not work in IE.
So, I want to know what is going on?
Also, I'm afraid if he will restart the change event, if I click on the checked radio?
UPDATE:
I can not add a comment, so I answer here.
I am using IE8, and the Furqan link gives me also does not work in IE8. I do not know why...
jquery radio-button
hguser Mar 02 '11 at 10:00 2011-03-02 10:00
source share