Resetting a function

Resetting a function

This is probably noobalicious so apologies, i have a checkbox i am checking on and off and then setting a readonly input with a value depending upon if it is checked on/off

$("input[type=checkbox]").change(function(){
      $("input#showvalue").val(50);
      $("input[type=checkbox]").change(function(){
         $("input#showvalue").val(0);
         // something here?
      });
   });


This works fine for one click on or off but then how do i get back out of the function once this cycle has been done once? Set something to null?

Thanks in advance