Javascript onClick clear does not work inside php echo
<p>Here is code without php echo and it works.</p>

<pre><code>&lt;tr id='row1'&gt;
&lt;td&gt;&lt;input type="text" name="date_day[]" id="date_day1" class="row_changed1"size="1"&gt;&lt;/td&gt;
&lt;td&gt;
&lt;a href="javascript://" onClick="clearChildren(document.getElementById('row1'))"&gt;Clear&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
</code></pre>

<p>But I must use the same in php echo</p>

<p>Tried this</p>

<pre><code> echo "&lt;tr id='row11'&gt;

 &lt;td&gt;
 &lt;input type='text' name='date_day[]' id='date_day1' class='row_changed1' value='" .$post_date_day. "' size='1'&gt;
 &lt;/td&gt;

 &lt;td&gt;
 &lt;input type='text' name='entry_id[]' id='entry_id1' class='row_changed1' size='5' value='".$post_entry_id ."' &gt;
 &lt;/td&gt;

 &lt;td&gt;
 &lt;input type='text' name='row_id[]' id='row_id1' value='" .$post_row_id ."' size='1'&gt;
 &lt;/td&gt;

 &lt;td&gt;
 &lt;a href=\"javascript://\" onClick=\"clearChildren(document.getElementById('row11'))\"&gt;Clear&lt;/a&gt;

 &lt;/td&gt;

 &lt;/tr&gt;";
</code></pre>

<p>But does not clear. Possibly because of incorrect usage of <code>'</code> and <code>"</code> but can not understand what is correct way. Experimented changing <code>'</code> to <code>"</code> and vice versa, but without success.</p>

<p>clearChildren function</p>

<pre><code>function clearChildren(element) {
for (var i = 0; i &lt; element.childNodes.length; i++) {
var e = element.childNodes[i];
if (e.tagName) switch (e.tagName.toLowerCase()) {
case 'input':
switch (e.type) {
case "radio":
case "checkbox": e.checked = false; break;
case "button":
case "submit":
case "image": break;
default: e.value = ''; break;
}
break;
case 'textarea': e.value = ''; break;
case 'select': e.selectedIndex = -1; break;
default: clearChildren(e);
}
}
}
</code></pre>

<p>And view source (selected) is this</p>

<pre><code>input name="date_day[]" id="date_day1" class="row_changed1" value="" size="1" type="text"&gt;

&lt;input name="entry_id[]" id="entry_id1" class="row_changed1" size="5" value="24/1305" type="text"&gt;

&lt;input name="row_id[]" id="row_id1" value="24" size="1" type="text"&gt;

&lt;a href="javascript://" onclick="clearChildren(document.getElementById('row11'))"&gt;Clear&lt;/a&gt;
</code></pre>
