title: Any ideas on simplify my code?
body: <p>Any ideas how to apply DRY practice here? I know that I am repeating to much and I don't like it. But I don't know how to solve it. It would be great to simplify this unit convertor. Thanks everyone for any help.</p>
  
  <pre><code>$(':input').bind('keypress keydown keyup change',function(){
          var input = parseFloat($(':input[name="input"]').val())
  
          var output1  = '';
          var output2  = '';
  
          if ($("#unitSelector").val() === 'celsius'){
              output1 = ((input * 9) / 5 + 32).toFixed(5).toString();
              output2 = (input + 273.15).toFixed(5).toString();
  
          $(':input[name="output1"]').val(output1 + " " + "Fahrenheit");
          $(':input[name="output2"]').val(output2 + " " + "Kelvin");
          }
  
          if ($("#unitSelector").val() === 'fahrenheit') {
              output1 = ((input - 32) * 5 / 9).toFixed(5).toString();
              output2 = ((input + 459.67) * 5 / 9).toFixed(5).toString();
  
          $(':input[name="output1"]').val(output1 + " " + "Celsius");
          $(':input[name="output2"]').val(output2 + " " + "Kelvin");
          }
  
          if ($("#unitSelector").val() === 'kelvin') {
              output1 = (input - 273.15).toFixed(5).toString();
              output2 = (9 / 5 * (input - 273) + 32).toFixed(5).toString();
  
          $(':input[name="output1"]').val(output1 + " " + "Celsius");
          $(':input[name="output2"]').val(output2 + " " + "Fahrenheit");
          }
      });
  </code></pre>