I want to be able to uncheck a radio button by clicking on it.

So, if a radio button is unchecked, I want to check it, if it is checked, I want to uncheck it.

This does not work:

$('input[type=radio]:checked').click(function(){
    $(this).attr('checked', false);
});

I am not able to check a radio button now.

Here's a super lightweight script you can add to a page through the console window that allows you to deselect a radio button by holding down <kbd>Ctrl</kbd> while clicking it with the mouse.

<!-- language: lang-js -->
document.addEventListener('click', function(e){
   if (e.ctrlKey == true && 
       e.target.tagName == 'INPUT' && 
       e.target.type == "radio" && 
       e.target.checked == true) {
       e.target.checked = false;
   }
});

Since it doesn't rely on jQuery, you can easily add it to any page to temporarily allow deselection.
For slightly more info, you can read an article I just wrote on How To Deselect A Radio Button.