How to get value of edit text with jquery
<p>Hi i want to get changed text value from JQuery but i can't select edit text with JQUERY because edit texts generated from php while loop that this php code query on database and get value of edit texts and in my program i have edit button for every edit texts and when the user changed value of edit text i select new value and when user click edit button send this value from get method to another php page with jquery <code>$.ajax</code> function and send new value to that php code with ajax.But i don't know how can i select edit text that it's value changed because i don't know id of that edit text!.And when i set one id for every edit text i only get first edit text value from <code>$("#id").change().val();</code>.I use below code but it doesn't work.I am beginner in java script and don't know how fix this problem!.  </p>

<pre><code>var testAnswer;

function setNewTestAnswer(id){
    testAnswer = $("#id").val();
}
function sendToEdit(pID,phID,thDate,type){
    var info = 'pId='+pID+'&amp;phId='+phID+'&amp;testAnswer='+testAnswer+'&amp;thDate='+thDate+'&amp;type='+type;
}
</code></pre>

<p>2nd function use testAnswer that user changed in edit text.<br>
php code  </p>

<pre><code>&lt;?php
    include 'Connect.php'; 
    if(match($_POST['pId'], "/^[\d]+$/") ){
        $pId = $_POST['pId'];
        $result = mysql_query("select pName, pID, phName, phID, testHistoryDate, type, testAnswer from patient join reception using(pID) join physician using(phID) join testHistory using(rID) join test using(tID) where pID = $pId",$connection);
    }
    else
        die("Insert true value");
    while($row=mysql_fetch_array($result)){
        echo "&lt;tr&gt;&lt;td&gt;";
        echo $row["pName"].'&lt;/td&gt;';
        echo '&lt;td&gt;'.$row["phName"].'&lt;/td&gt;';
        echo '&lt;td&gt;'.$row["testHistoryDate"].'&lt;/td&gt;';
        echo '&lt;td&gt;'.$row["type"].'&lt;/td&gt;';
        $type =  $row['type'];
        $testHistoryDate = $row['testHistoryDate'];
        ?&gt;
        &lt;td&gt;
            &lt;span id='spryTanswer'&gt;
                &lt;input type='text' name='tAnswer' id='tAnswer' value='&lt;?php echo $row['testAnswer']; ?&gt;' /&gt;
            &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;input type='submit' value='Edit' name='edit' id='edit' onclick="sendToEdit('&lt;?php echo $row['pID'] ?&gt;','&lt;?php echo $row['phID'] ?&gt;', '&lt;?php echo $row['testHistoryDate'] ?&gt;', '&lt;?php echo $row['type'] ?&gt;')" /&gt;
        &lt;/td&gt;
        &lt;/tr&gt;
    &lt;?php } ?&gt;
</code></pre>
