I'm trying to get the id when I click different messages.

This is my javascript:

```
 $(document).ready(function() {
      $('#message-subject-result').click(function(){
      var message = document.getElementById('message_id').value;
      alert(message);

      });
 });

```

I am pulling it from a php function that is:

```
 <div id="message-subject-result">
 <div id="message-date">'.$date.'</div>
 <input type="hidden" id="message_id" value="'.$row['mes_id'].'"><div id="message-sender-name">FROM: '.$row['firstname'].' '.$row['lastname'].'</div>
 <div id="message-subject">SUBJECT: '.$row['subject'].'</div>
 <div id="message-preview">'.$row['message'].'</div>
 </div>

```

The javascript works but only when I click on the first echoed result. What am I doing wrong?