while-loop Jquery working only once

while-loop Jquery working only once

Dear Jquery user,
I have a question.
I have while loop, where something is defined via ID, I called it pin_click.
So of course there are a few entries.
And I have the following Code:
  1.         $('#pin_click').button()
                .click(function() {
                    var ID = $('#entrie_id').val();
                        $.ajax({
                        url: 'changepin.php',
                        type: 'POST',
                        data: 'ID=' + ID,
                        success: function(result) {
                        if(result == '1'){
                        $('#pin_symbol').toggleClass('ui-icon ui-icon-pin-s');
                        $('#pin_symbol').toggleClass('ui-icon ui-icon-pin-w');
                        }else{
                        $('#pin_symbol').toggleClass('ui-icon ui-icon-pin-s');
                        $('#pin_symbol').toggleClass('ui-icon ui-icon-pin-w');
                        }
                        }                   
                    });   
                });   

















Somehow, this Code only works for the first element, I get out of the while loop.
The other elements of the while loop ( which have the same Button ) are just doing nothing, even no action in Firebug.

Can someone help me?
Thankyou!