어떻게 내가 지금까지 수행 한 어떤 select
jQuery를 특정 OPTGROUP을 선택하고 제거 옵션
의 특정 optgroup
의 옵션을 제거 할 수 있습니다
function(data)
{
$('.'+id).each(function()
{
$(this).find('option').remove();
$.each(data, function(index, value) {
$('<option>').text(value).appendTo('.'+id);
});
});
}
그리고 select
는
<select id="testers" class="testers_team-${info.problemId}">
<optgroup label="Current Assigned Tester">
<option>I'll think about this later</option>
</optgroup>
<optgroup label="Testers" class="test_list">
<c:forEach var="testers_per_team" items='${test.KwekKwek}'>
<option>${testers_per_team}</option>
</c:forEach>
</optgroup>
</select>
입니다
optgroup class="test_list"
의 옵션을 제거하고 다시 채우고 싶습니다. 옵션을 추가했지만 성공하지 못했습니다.
- 는 께서 여러 OPTGROUP
- 현재 해당
- 에 추가 옵션을 제거하는 선택과 특정 OPTGROUP을 선택 현재 을 선택한 OPTGROUP에 새로운 옵션을 추가 FIC
optgroup
내가 방법을 알고 싶어요
위 스크립트는 Ajax
아래에 있지만 드롭 다운의 모든 옵션이 제거되므로 도움을 받으십시오.
참고 :testers_team-${info.problemId}
의 값은 당신이 비우고 선택에 추가, 찾고 있습니다
은 $에서 ID "의 값 ('.'+ ID) 란 무엇입니까 – Baral
$를 ('.'+ ID)는 코드의 드롭 다운의 클래스 간단히 말해서'class = "testers_team - $ {info.problemId}"'와 같은 값을 가지고 있습니다. 위의 "select"에 게시되었습니다. – newbie