I know that it is possible to do in two functions, but I am not sure how to make it in one.
$("#purchase_sub_type").change(function() {
if($(this).val() == 15) {
console.log('is 15');
}
else {
console.log('not 15');
}
});
This is example code. Problem is that this code works only on change, not when value is loaded form DB on page reload. Is there simple way to add current val to this function? I know that it is possible adding another function, but in that way code gets ugly and repeats.