0

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.

1
  • 1
    this.id or this.name within the event handler. If you need more specific help, please add the relevant code to the question. Commented Jul 5, 2022 at 7:20

1 Answer 1

2
$('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" />
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.