[js] n.fn.init 반복문으로 value값 가져오기

Sora Kim·2022년 11월 23일
0

JS / jquery

목록 보기
10/12
post-thumbnail

html

<form id="NotiBoardSearchForm>
	<input type="hidden" class="pHidden" value="2">
    <input type="hidden" class="pHidden" value="1">
    <input type="hidden" class="pHidden">
    <input type="hidden" class="pHidden">
    <input type="hidden" class="pHidden">
    <input type="hidden" class="pHidden">
    <input type="hidden" class="pHidden">
    <input type="hidden" class="pHidden">
</form>

selector가 여러개일 때, 전체에 대한 value값은 selector[index].value를 사용해서 불러올수 있다.

js


let selectorList = $("#notiBoardSearchForm").find(".pHidden");
//대상 id form 에 자손중 pHidden을 가지는 selector 전부 불러오기
$.each(selectorList, function(index){
	console.log("====",index + ","+ selectorList[index].value);
})

console 결과보기

profile
개발잘하고시풔!!!!!!!

0개의 댓글