Error when get ID in jquery
<p>I have a code php:</p>

<pre><code>&lt;?php
for ($i=0, $n=count( $this-&gt;item ); $i &lt; $n; $i++) {
$row = &amp;$this-&gt;item[$i];
?&gt;
&lt;tr id="&lt;?php echo $row-&gt;id; ?&gt;" class="row"&gt;
&lt;span id="name_&lt;?php echo $row-&gt;id; ?&gt;" class="text"&gt;&amp;nbsp;&lt;?php echo $row-&gt;name; ?&gt;&lt;/span&gt;
&lt;input type="text" value="&lt;?php echo $row-&gt;name; ?&gt;" class="editbox" id="name_input_&lt;?php echo $row-&gt;id; ?&gt;" /&gt;
&lt;/tr&gt;
&lt;?php
$i++;
}
?&gt;
</code></pre>

<p>and Jquery get id from this script php</p>

<pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $('.row').click(function(){
       var ID = $(this).attr('id');
       $('#name_'+ID).hide(); 
       $('#name_input_'+ID).show();
       alert(ID); 
    });
});
&lt;/script&gt;
</code></pre>

<p>Error when i output alert(ID) result is NULL, How to get ID ? </p>
