Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have a multiple-input field and an onchange function. When we change the input field from the event it triggered, I want to get the name or id of the input field (to distinguish it from other input fields). Many thanks.
this.id
this.name
$('input[type="text"]').on('change', function(){ // name is a unique attribute $(this).attr("name")); }); <input type="text" name="text1" /> <input type="text" name="text2" /> <input type="text" name="text3" />
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
this.idorthis.namewithin the event handler. If you need more specific help, please add the relevant code to the question.