일부 플러그인은 옵션 페이지의 '조건부'드롭 다운으로 구성되어 있습니다. 기본적으로 세 가지 옵션이있는 드롭 다운 목록이 있는데 두 번째 드롭 다운에는 첫 번째 드롭 다운에서 선택한 항목에 따라 데이터베이스의 정보가 채워집니다. 문제는 두 번째 드롭 다운을 채우는 방법에 대한 손실이 있습니다! 나는 AJAX에 그렇게 큰 것은 아니지만 가능성있는 해결책으로 보인다. 더 노련한 집안의 모든 생각은 여기 있니?Wordpress 옵션 페이지에서 동적으로 생성 된 드롭 다운
편집 : 나는 현재 어딘지 여기지만 결코 얻을 것 같다 실행 :
<form action="<?php echo site_url() ?>/wp-admin/admin.php?page=ad_manager&pagetype=addedit&pid=<?php echo $_REQUEST['id']; ?>" method="post" name="ad_success">
<table cellpadding="5" class="widefat post fixed">
<thead>
<tr>
<th><strong><?php if($_REQUEST['id'] != '') { _e('Edit Ad'); } else { _e('Create Ad'); } ?></strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<label for="gtad_condition">
<strong><?php _e('Ad Condition'); ?>:</strong>
<select name="ad_condition" id="ad_condition">
<option value="">Select an option...</option>
<option value="is_city">Is City</option>
<option value="is_location">Is Location</option>
<option value="is_page">Is Page</option>
</select>
</label>
<label for="gtad_location">
<select name="ad_location" id="ad_location"></select>
</label>
</td>
</tr>
</tbody>
</table>
</form>
<script>
jQuery(document).ready(function() {
$ad_condition = $("select[name='ad_condition']");
$ad_location = $("select[name='ad_location']");
$ad_condition.change(function() {
if ($(this).val() == "Is City") {
$("select[name='ad_location'] option").remove();
$("<option>Test</option>").appendTo($ad_location);
}
});
});
</script>
내 p ost 현재 코드와 함께 ... –
JS 문제를 해결하는 데 도움이되는 내 대답을 편집했습니다. – Config
한 번 이상 투표 할 수 있다면 ... 고마워요 !!! –