I have HTML form, where I use "radio" buttons, but I would like them to work as if they were a combination of radio and checkbox: one option is possible to be checked but also there is a possibilty to unselect an option. 

My form is here:

```
<form name="myform">
<input type="radio" name="transport" value="transport1">
<input type="radio" name="transport" value="transport2">
<input type="radio" name="transport" value="transport3">
</form>

```

I found nice function to do it:

```
<script>
    $(document).ready(function() {
(function ($) {
$.fn.uncheckableRadio = function () {

    return this.each(function () {
        var radio = this;
            $('label[for="' + radio.id + '"]').add(radio).mousedown(function () {
                $(radio).data('wasChecked', radio.checked);
            });

            $('label[for="' + radio.id + '"]').add(radio).click(function () {
                if ($(radio).data('wasChecked'))
                    radio.checked = false;
            });
       });
};
})(jQuery);

$('input[type=radio]').uncheckableRadio();
});

</script>

```

But this function harms my different function , which is used to count price from form inputs (when I select radio buton price is added correctly, but when I deselect buton it doesn't change):

```
function count_price()
        {
        var price=0;

        if (document.forms["myform"].transport[0].checked) {price+=100;}
        if (document.forms["myform"].transport[1].checked) {price+=50;}
        if (document.forms["myform"].transport[2].checked) {price+=200;}    
        }

        document.all["counted_price"].innerHTML=price;
        };

```

Without using this "uncheckableRadio" function my count\_price function works well.