So I am trying to pass an input ID and get its corresponding type.
Eg.
<input id = "1" type = "date"/>
<input id = "2" type = "text"/>
So passing "1" would return date and passing "2" would return text.
I have looked at a few examples but none that work for my case:
How to use jquery selector having element type and ID
finding the type of an element using jQuery
What I have so far:
$("#my_select").on('click',function(){
var fieldID = document.querySelector('.selected').id
console.log("id is " + fieldID);
var elementType = $(this).prev().prop('.selected');
console.log("element type " + elementType)
});