Obtain the name of the input at the time it is entered in input.

Asked 2 months ago, Updated 2 months ago, 2 views

I am currently practicing JavaScript.
I use jQuery below.

<script src="js/jquery-3.2.1.min.js"></script>

I would like to obtain the name of the input when the text is entered in the input text area of the form (keyup timing). Is there any way?
I would appreciate it if you could let me know if anyone knows.

$('input').on('keyup', function(){
    // I'd like to get the name of the target input here.
    // I looked into various things, but I couldn't find them at all.

javascript jquery

2022-09-30 11:45

1 Answers

Attribute="name" value can be taken as $(this).attr.

var attribute=$(this).attr("name");

2022-09-30 11:45

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.