Try:

$('input[type=text]').each(function(i) {
 $(this).click(function() {
  alert(i);
 });
});

MaurĂ­cio

-----Mensagem Original----- De: "bittermonkey" <brakes...@gmail.com>
Para: "jQuery (English)" <jquery-en@googlegroups.com>
Enviada em: segunda-feira, 2 de fevereiro de 2009 17:47
Assunto: [jQuery] How do I get the index of the currently clicked textbox?



Hi,

How do I get the index of the currently clicked textbox?  I have 5
textboxes in a form, all of which I am binding a click event.  Here is
the code:

       $("#associate-form input[type=text]").bind("click", function()
{
           alert(this);  //what is its index position from the 5
other textboxes?
       });

Thanks in advance.

Reply via email to