无法使用jquery在td类中获取值

I am new to web development and one thing that is driving my head mad is that I am unable to get the value for one of the values in my table.

At present this is my code:

<?php
...
if(($result->num_rows)>0){
    while($row = $result->fetch_assoc()){
        print
        "<tr>".
            "<td id='numbers' class='col-md-4 text-center'>{$row["number"]}</td>".
            "<td class='col-md-1 text-center'>$row["names"]</td>".
        "</tr>";
    }
?>

<script type="text/javascript">
        var jz = $('#numbers').val();
        alert(jz);
</script>

I am using bootstrap so I am probably not setting the ID properly for the td tag. Nothing is being returned for the #numbers. I don't get why

Would mean a lot if someone could help me out

Thanks

It's not .val(), use .text() or .html() instead. .val() is used on input fields like textarea.

http://api.jquery.com/val/

http://api.jquery.com/text/

Code for the question below:

$index = 1;
while($row = $result->fetch_assoc()){
    print
    "<tr>".
        "<td id='numbers".$index."' class='col-md-4 text-center'>{$row["number"]}</td>".
        "<td class='col-md-1 text-center'>$row["names"]</td>".
    "</tr>";
    $index += 1;
}