내가 모든 드롭을 통해 루프를 원하는 특정 클래스 이름을 선택하고 여기에 항목을 추가하고 난 그냥 올바른 선택으로 고민하고특정 클래스 이름으로 모든 선택 드롭 다운을 가져 오는 올바른 jquery 선택기는 무엇입니까?
편집 : 나는 대부분으로 뭔가 잘못하고 있어야합니다 upvoted 받아 들여진 응답은 일하지 않는다 그래서 나는 나의 부호에있는 약간 변칙이이어야한다 것을 생각한다. 아래 HTML과 jquery 코드를 모두 붙여 넣었습니다. 이 말이 맞는다면 알려주십시오.
HTML :
<select onfocus="this.enteredText='';" onkeydown="return handleKey();" onkeyup="event.cancelbubble=true;return false;" onkeypress = "return selectItem();" class="componentSelect" id="components0" name="applicationUpdater.dependencies[0].componentName" >
<option value= 5 >Client</option>
<option value= 79 >Server</option>
</select>
<select onfocus="this.enteredText='';" onkeydown="return handleKey();" onkeyup="event.cancelbubble=true;return false;" onkeypress = "return selectItem();" class="componentSelect" id="components1" name="applicationUpdater.dependencies[0].componentName" >
<option value= 5 >Client</option>
<option value= 79 >Server</option>
</select>
등. . .
jQuery 코드는 :
$('select.componentSelect').each(function() {
var select = $(this);
$(select).children('option').each(function() {
if ($(this).text() == currentComponentName) {
$(this).remove();
}
});
});
왜 이것을 다운 그레이드 했습니까? – SLaks