입력이 확인란인지 여부를 알고 싶습니다. 다음이 작동하지 않습니다.
$("#myinput").attr('checked') === undefined
다시 한번 감사드립니다!
답변
의사 선택기 :checkbox
를 jQuery is
함수 호출과 함께 사용할 수 있습니다 .
$('#myinput').is(':checkbox')
답변
>>> a=$("#communitymode")[0]
<input id="communitymode" type="checkbox" name="communitymode">
>>> a.type
"checkbox"
또는 더 많은 jQuery 스타일 :
$("#myinput").attr('type') == 'checkbox'
답변
$("#myinput").attr('type') == 'checkbox'
답변
비 jQuery 솔루션은 jQuery 솔루션과 매우 유사합니다.
document.querySelector('#myinput').getAttribute('type') === 'checkbox'
답변
이 기능을 사용하십시오 :
function is_checkbox(selector) {
var $result = $(selector);
return $result[0] && $result[0].type === 'checkbox';
};
또는이 jquery 플러그인 :
$.fn.is_checkbox = function () { return this.is(':checkbox'); };
답변
$('#myinput').is(':checkbox')
이것은 확인란이 선택되어 있는지 여부를 감지하는 문제를 해결하는 유일한 작업입니다. 그것은 true 또는 false를 반환하고, 몇 시간 동안 검색하고 모든 것을 시도합니다. 이제 EDG를 브라우저 및 W2UI로 사용한다는 것이 분명합니다.
답변
