I have this input which is a radio button(example2) and I have others radio buttons with different purposes.
<input name="example2" id="sent" type="radio" value="3">
<input name="example2a" id="sent" type="radio" value=" ORDER BY date_hour DESC ">
I have this code for check and uncheck my radio buttons.
<script type="text/javascript">
(function( $ ){
$.fn.uncheckableRadio = function() {
return this.each(function() {
$(this).mousedown(function() {
$(this).data('wasChecked', this.checked);
});
$(this).click(function() {
if ($(this).data('wasChecked'))
this.checked = false;
});
});
};
})( jQuery );
$('input[type=radio]').uncheckableRadio();
</script>
And now the code for checking my radio button or uncheck:
$('#sent').change(function(){
if( $('#sent').prop("checked")){
status=3;
} else {
status=2;
}
I can change the status when I check the radio button but i can´t change the status when I uncheck the radio button.
What I'm looking for is if the radio button is checked i want status = 3 and if radio button is unchecked status = 2.
Thank you for you help.
Aucun commentaire:
Enregistrer un commentaire