Change Check All and UnCheck All Button

Change Check All and UnCheck All Button

I have following code to have an Uncheck button button on the form.
I would like to toggle between Uncheck and Check All when user click,
The initial value on the button is Uncheck which the text change to Check all, but it does not change back to Uncheck all.

Any suggestion is great appreciated,

Regards,

iccsi

jQuery("#btnCheck").click(function(event)
    {
         alert($("#btnCheck").attr("value"));
         if ($("#btnCheck").attr("value") == "Check All")
         {
                 $("#Mychk").prop('checked', true);
   
        $(this).prop('value', 'Uncheck All');
       
         }
         else

        {
        $("#Mychk").prop('checked', false);
        $(this).prop('value', 'Check All');
        }
       
    });


 <td><input name="btnCheck" type="button" id="btnCheck" value="Uncheck All"/>
                 </td>