I have this 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);
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 !