I have a form like this:
<form name="filter">
<input type='number'>
<input type="text">
<input type="range">
</form>
I want to get the type of input i use but i do not succeed in it
$(document).on('input', 'form[name="filter"]', function () {
alert(this.type); // alerts undefined
});
Based on the input i use, i expect an alert like: number, text or range, but i got "undefined"
What i am doing wrong?
3
Answers
You need to add parameter & use like this to get
input
type.Alternative you can use it by getting event parameter from the function