jQuery to retrieve id and modify its text
<p>I have a table generated by php and implementing a modal to allow user to change the text generated by variable <code>$l_id</code>; I have a link class "eloc" that show's the modal div section. I intercept the form submit id "renameLocation" and process the input and disable the default submit action. I want to modify show the new text renamed by the user.</p>

<p>I have this php code which repeated by iterating an array, the iteration id is <code>$l</code></p>

<pre><code>$id_l="\"location_".$l."\"";
echo "&lt;table class=\"add\" border=\"1px\" width=\"100%\"&gt;";
echo "&lt;tr class=\"header\"&gt;&lt;td class=\"stretch\"&gt;&lt;a class=\"eloc\" rel=\"leanModal\" href=\"#modal_location\"&gt;&lt;img src=\"images/edit-icon.png\" alt=\"Location\"&gt;&lt;/a&gt;&lt;/td&gt;&lt;td id=\"".$id_l."\" class=\"location\" colspan=\"6\"&gt;Location: ".$row['location']."&lt;/td&gt;&lt;/tr&gt;";
</code></pre>

<p>Then I have a div:</p>

<pre><code>&lt;div id="modal_location" class="modal_prompt"&gt;      
    &lt;div class="modal_prompt-ct"&gt;           
        &lt;div class="modal_prompt-header"&gt;
            &lt;h2&gt;Rename Location&lt;/h2&gt;
            &lt;a class="modal_close" href="#"&gt;&lt;/a&gt;            
        &lt;/div&gt;

        &lt;form id="renameLocation"&gt;
            &lt;div class="txt-dpy"&gt;
                &lt;span id="mlocation_name"&gt;&lt;/span&gt;
            &lt;/div&gt;
            &lt;div class="txt-fld"&gt;
                &lt;label for=""&gt;Change to&lt;/label&gt; 
                &lt;input id="newLocation" name="" type="text" /&gt;
            &lt;/div&gt;
            &lt;div class="btn-fld"&gt;
                &lt;button type="submit"&gt;Save &amp;raquo;&lt;/button&gt;
            &lt;/div&gt;          
        &lt;/form&gt;         
    &lt;/div&gt;  
&lt;/div&gt;
</code></pre>

<p>How to modify the text for the generated $l_id?</p>

<pre><code>$("#renameLocation").submit(function(e) 
{
    $("#lean_overlay").fadeOut(200);
    $("#modal_location").css({"display" : "none" })
    // How to modify the text of "$l_id"?
    return false; //do not submit form the normal way        
});
</code></pre>

<p>Many thanks.</p>
