

HTML structure:
Plaintext
<td><span id="<a>is_mar431</a>"><input class="<a>is_mar</a>" value="<a>0</a>" id="<a>is_mar431_0</a>" checked="<a>checked</a>" type="<a>radio</a>" name="<a>is_mar431</a>" /> <label for="<a>is_mar431_0</a>">否</label> <input class="<a>is_mar</a>" value="<a>1</a>" id="<a>is_mar431_1</a>" type="<a>radio</a>" name="<a>is_mar431</a>" /> <label for="<a>is_mar431_1</a>">是</label></span></td>
// JS structure (before):
// Whether it is damaged; select Yes to display the damage information input text box
$("span[id^=is_mar] :radio").change( function() {
var this_name = $(this).attr("name");
var input_id = 'mar_note_'+this_name.substring(6);
if ($("input[name="+this_name+"]:checked").val() == 1) {
$("#"+this_name+"").after('<span id="J_'+input_id+'"> 损坏信息:<input id="'+input_id+'" type="text" tabindex="3" name="'+input_id+'" value="" /></span>');
} else {
$("#J_"+input_id+"").remove();
}
});
// JS structure (after):
// Whether it is damaged; select Yes to display the damage information input text box
$("span[id^=is_mar] :radio").live("change",function() {
var this_name = $(this).attr("name");
var input_id = 'mar_note_'+this_name.substring(6);
if ($("input[name="+this_name+"]:checked").val() == 1) {
$("#"+this_name+"").after('<span id="J_'+input_id+'"> 损坏信息:<input id="'+input_id+'" type="text" tabindex="3" name="'+input_id+'" value="" /></span>');
} else {
$("#J_"+input_id+"").remove();
}
});
// URL referencing live: http://www.w3school.com.cn/jquery/event_live.asp
