Using arrays in Jquery

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-05-30T16:01:27Z Indexed on 2010/05/30 16:12 UTC
Read the original article Hit count: 173

Filed under:
|
|
|

Here is a code:

<input type="button" id="array[1]" value="Value1" />
<input type="button" id="array[2]" value="Value2" /> 
<input type="button" id="array[3]" value="Value3" /> 

And I want to do something like that:

$('#array').click(function() {
    id = this.id;       
    $.ajax({
        here goes type, url, data and else
    });     
})  

I want to id add array's number. For example, if I click button where id is array[3] so id gets value of 3 in Jquery's function. Hope you got what I mean.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript