title: Jquery , access variable from function
body: <p>I have this code</p>
  
  <pre><code>function getSelectData(id) {
      jQuery(id).change(function () {
          var value='';
          jQuery(id+" option:selected").each(function () {
              value =jQuery(this).val() ; 
          });
          console.log(value);
      });
      return value;
  }
  
  var d = getSelectData("#sort_post_date");
  console.log(d);
  </code></pre>
  
  <p>How i can access variable "value" ,  i tried different methods , but nothing ,  where is console.log(value); , value exit , but outside nothing , Thank You for Helping !</p>