깜놀하는 해므찌로

사용자 정의 속성 HTML attr data-속성이름 본문

IT

사용자 정의 속성 HTML attr data-속성이름

agnusdei1207 2022. 7. 5. 08:03
반응형
SMALL
<td colspan="3">                    
    <ul id="receiver" class="mail_select_list">                               
        <c:if test="${fn:length(userList) gt 0 }">                     
            <c:forEach var="user" items="${userList }">       
                <li id="${user.seq}-${user.position }-" class="mail_select_obj" data-userInfo="${user.seq}-${user.position }&${user.name }_${user.position }" style="display:inline-block; width:17%;">   
                    <c:out value="${user.name }_${user.position }"/>              
                    <c:if test="${(searchVO.procType eq 'update' && mgr0117VO.state eq 'N' && loginVO.seq eq mgr0117VO.rgstSeq) || (searchVO.procType eq 'insert') || (loginVO.authCode eq '1')}">
                        <a class="mail_del btn_del cursor" onclick="fncUserDel('${user.seq}-${user.position }', '${user.seq}-${user.position }&${user.name }_${user.position }');" style="display:inline-block;">x</a>
                    </c:if>
                </li>   
            </c:forEach>       
        </c:if>     
    </ul>                
</td>

1. data-userInfo = ""  : data-속성명 = "넣을 값"

2. key : value 구성

<%-- 페이지 로드 --%>             
$(function(){                  
	$(".mail_select_obj").each(function(){    
		checked.push($(this).attr("data-userInfo")); 
	});              
	fncDate('eatDate');    
	return false;  
});

3. jQuery attr 함수로 해당 속성에 접근하여 값을 가져오거나 수정할 수 있다.

반응형
LIST