title: Set jQuery datepicker minDate depending on input
body: <p>I'm trying to make a jQuery datepicker set <code>minDate</code> depending on the value of a radio button. </p>
  
  <p>When I try to write a function returning a string, my JavaScript keeps crashing. Any ideas on why this is not working?</p>
  
  <pre><code>$("#datepicker").datepicker({
      changeMonth: true,
      changeYear: true,
      yearRange: "-35:+0",
      dateFormat: "yy-mm-dd",
      minDate: function() {
          var str = "-35Y";
          if($("#inputfield").val() == "value") {
              str = "-33Y";
          }
          return str;
      }
  });
  </code></pre>