我想获取一个选定选项的父项,它是一个 td,然后使用 insertAfter 在它之后插入另一个 td,但引用返回 null?有人能告诉我为什么吗?
谢谢
JQ('.defieldselect').live('change',function(){
var $option = JQ(this).find('option:selected');
if($option.attr('rel')=='Date'){
var ddlID = $option.parent().parent().parent().find('.criteria-value').find('input').attr("id");
var index = ddlID.split("_")[1];
var select = CreateDateSelectList(index);
$(select).insertAfter($option.parent);
}
});
HTML
<tr>
<td id="g1_c0_criteria_field" class="criteria-field">
<select class="defieldselect" name="g1_c0_criteria_field">
<option rel="Text">Product ID 1</option>
<option rel="Date">Date Added</option>
</select>
</td>
<td class="criteria-operator">
<select id="g1_c0_criteria_operator" name="g1_c0_criteria_operator">
<option value="=">is equal to</option>
<option value="!=">is not equal to</option>
<option value=">">is greater than</option>
<option value="<">is less than</option>
<option value="LIKE">contains</option>
<option value="NOT LIKE">does not contain</option>
<option value="LIKE">begins with</option>
</select>
</td>
</tr>