Here is code without php echo and it works.
<tr id='row1'>
<td><input type="text" name="date_day[]" id="date_day1" class="row_changed1"size="1"></td>
<td>
<a href="javascript://" onClick="clearChildren(document.getElementById('row1'))">Clear</a>
</td>
</tr>
But I must use the same in php echo
Tried this
echo "<tr id='row11'>
<td>
<input type='text' name='date_day[]' id='date_day1' class='row_changed1' value='" .$post_date_day. "' size='1'>
</td>
<td>
<input type='text' name='entry_id[]' id='entry_id1' class='row_changed1' size='5' value='".$post_entry_id ."' >
</td>
<td>
<input type='text' name='row_id[]' id='row_id1' value='" .$post_row_id ."' size='1'>
</td>
<td>
<a href=\"javascript://\" onClick=\"clearChildren(document.getElementById('row11'))\">Clear</a>
</td>
</tr>";
But does not clear. Possibly because of incorrect usage of '
and "
but can not understand what is correct way. Experimented changing '
to "
and vice versa, but without success.
clearChildren function
function clearChildren(element) {
for (var i = 0; i < 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);
}
}
}
And view source (selected) is this
input name="date_day[]" id="date_day1" class="row_changed1" value="" size="1" type="text">
<input name="entry_id[]" id="entry_id1" class="row_changed1" size="5" value="24/1305" type="text">
<input name="row_id[]" id="row_id1" value="24" size="1" type="text">
<a href="javascript://" onclick="clearChildren(document.getElementById('row11'))">Clear</a>