You can try this:
$(function(){
var DoOnChange=function(){
console.log($(this).val());
};
$("input#inp").on("keyup",DoOnChange);
$("select#sl").on("change",DoOnChange);
});
And if you like using pure js and a legible code, look at code below:
window.onload=function(){
var DoOnChange=function(ev){
var el=ev.target;
console.log(el.value);
};
document.querySelector("select#sl").addEventListener("change",DoOnChange);
document.querySelector("input#inp").addEventListener("keyup",DoOnChange);
};
Or if you need change
event:
$(function(){
$("input,select").on("change",function(){
console.log($(this).val());
});
});
These codes works fine with html code like this:
<input type="text" id="inp"/>
<select id="sl">
<option>1</option>
<option>2</option>
</select>
I'm typing with my mobile phone and I haven't access to the code tools of stackoverflow
now, but if you want, you can check the result online.