I am developing a tool on a web page that has several forms for filling information, my query is if it is possible with javascript to differentiate between a select or an input.
I appreciate the help
I am developing a tool on a web page that has several forms for filling information, my query is if it is possible with javascript to differentiate between a select or an input.
I appreciate the help
It's very simple, all the elements have their name saved in the tagName
attribute
let c1=document.getElementById('campo1');
let c2=document.getElementById('campo2');
console.log('es un',c1.tagName)
console.log('es un',c2.tagName)
<input id="campo1"/>
<select id="campo2"><option value="valor">Algo</option>