I'm loading multiple clients on a page, each record with its own <textarea>. I set each <textarea> with the client's clientid.
if(isset($_POST['loaddata'])){
    try{
        $stmt = $db->prepare('SELECT clientid, fname, lname
                            FROM clients
                            WHERE memberid = :memberid  
                            AND groupid = :groupid
                            ORDER BY lname');
        $stmt->bindValue(':memberid', $_SESSION["memberid"], PDO::PARAM_INT);
        $stmt->bindValue(':groupid', $_POST['groupid'], PDO::PARAM_INT);
        $stmt->execute();
        $result = $stmt->fetchAll();
        foreach($result as $row ) { $i++;
        echo '<tr style="'.getbgc($i).'">
                <td style="display:none">'.$row[0].'</td>
                <td style="width:auto;">'.$row[1].'</td>
                <td style="width:auto;">'.$row[2].'</td>
                <td><textarea id='.$row[0].' class="form-control" rows="1"></textarea></td>
            </tr>';
        }
    } ...
After the data loads, I test the <textarea> id's:
$.ajax({
        url     : 'wsparticipation.php',
        type    : 'POST',
        async   : false,
        data    : {
                    'loaddata'  : 1,
                    'groupid'   : temp
        },
        success:function(re){
            $('#showdata').html(re);
            $('#13').html("I am 13");
            $('#15').html("I am 15");
            $('#10').html("I am 10");
        } ...
and the textareas show the html.
When I get ready to save the the entered data, I set the clientid's into an array.
if(isset($_POST['getarray'])){
    $stmt = $db->prepare('SELECT clientid
                            FROM clients
                            WHERE memberid = :memberid  
                            AND groupid = :groupid
                            ORDER BY lname');
    $stmt->bindValue(':memberid', $_SESSION["memberid"], PDO::PARAM_INT);
    $stmt->bindValue(':groupid', $_POST['groupid'], PDO::PARAM_INT);
    $stmt->execute();
    $result = $stmt->fetchAll();
    $ret = array();
    foreach($result as $row ) {
        $ret[] = $row['clientid'];
    }
    echo json_encode($ret);
    exit();
}
$.ajax({
        url         : 'wsparticipation.php',
        type        : 'POST',
        datatype    : 'JSON',
        data        : {
                    'getarray'  : 1,
                    'groupid'   : temp
        },
        success:function(re){
            data = $.parseJSON(re);
            $.each(data, function(i, clientid) {
                alert(clientid);
                $('#clientid').html("hahaha");
            });
            $('#2').html("Made it here with this");
        }
});
The alert() indeed shows me each of the clientid's, but the next statement $('#clientid').html("hahaha"); does nothing. The last statement $('#2').html("Made it here with this"); puts that text in the appropriate textarea. 
So, since the alerts are showing me the clientid's, why am I not able to access the textarea using the clientid from $.each(data, function(i, clientid)? 


'#clientid'is just a string. Javascript does not have widely-supported string interpolation.