我一直在使用 Zend Framework 1 创建一个依赖/链接的 Zend_Form。
当一个 Zend_Form_element_Select
另一个 Zend_Form_Element_Select 被添加到表单时,正确的字段取决于第一个选择的值。
所以我添加了新的 Select :
$("#city-label").before(data);
这将在城市标签之前插入新的选择。
当第一个选择的值再次更改时,问题就会出现。然后一个新的 Select 被添加到表单中。理想情况下,我希望旧的
satellite element
是要删除的标签和选择。<dt id="satellite-label">
<label for="satellite" class="optional">Satelite</label>
</dt>
<dd class="ui-select">
<select name="satellite" id="satellite">
<option value="--Select One--" label="--Select One--">--Select One--</option>
<option value="5" label="Alex">Alex</option>
<option value="6" label="Patro">patro</option>
<option value="7" label="Zozo ">Zozo</option>
</select></dd>
<dt id="city-label"><label for="city" class="optional">City</label></dt>
然后用新元素替换。
最佳答案
在 AJAX 成功 中尝试此操作:
$("#satellite-label").remove();
$("#satellite").parent().remove();
关于javascript - Chained or Dependent 选择 Zend_Form jQuery 删除或替换表单元素?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20260600/