Hi when i click the radion button ,It always checked.I cannot uncheck the radion button am serching and try How to check/uncheck radio button on click? this link.
problems
I can check only once,once i click uncheck it always uncheck cannot work properly
code
<input value='' type='radio' id='one' onClick="getCurrentLocation()"/>
$('input[type=radio]').click(function(){
if (this.previous) {
this.checked = false;
}
this.previous = this.checked;
});
Is it your the only radio button?
Radio buttons vere developed for keeping one of possible states from the set.
So if there is only one radio button – change it with checkbox.
If you have several of them – choose some default one for unchecking currently selected.
But if you click on another radio from the set, it will became checked without need of special code.
(As far as I remember, there was no way to uncheck radio-button in browser with mouse click on it, so I don’t expect such behavour from scripts as well)
For checkbox you don’t need special code to uncheck it on click – it’s default behavour for them in all browsers!
If it’s only dessign question, then you can use IMG of empty and checked radio buttons, and onClick change the image. In this case you can keep your state in hidden input field.
But it will be confusing for your users…