Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get selected textbox id jQuery

Tags:

jquery

In my form I have several textboxes like txtItemCode1, txtItemCode2, etc.

I use this code to perform some action if I press enter on any of these, but I want to get the selected textbox id. How can I do that?

like image 374
Kasun Wanniarachchi Avatar asked Dec 22 '22 06:12

Kasun Wanniarachchi


1 Answers

variable id should have what you are looking for.

$('input[type="text"]').change(function(){
     var id = $(this).attr('id');
});
like image 132
Jose Vega Avatar answered Jan 08 '23 11:01

Jose Vega