$("tr[seq] a[href]").click(function() {
alert( $(this).attr("name") );
"<tr height='30' seq='{0}' commentCnt='{4}' depth='{4}' >" +
" <a href='#' name='{0}'>" +
" <td width='50' align='center'> {1} </td>" +
===>위의 html에서 tr[seq] a[href] 의 조건이 선택하는 부분은 tr[seq] 부분이 아니라 a[href] 부분이라서
<a href='#' name='{0}'> 의 값을 가져온다.
===>alert( $(this).attr("name") ); 했을때 undefined 란 것이 나오면
1. attr 속성에 name이 없는 경우
2. name 있어도 xml에서 값이 정의 안된경우
==================================================
alert( $("tr[seq] a[seq]").eq(5).attr("width") ); 의미는 tr부분에 seq속성이 있어야한다.
'15 jquery > 10 기초부분' 카테고리의 다른 글
21 selectbox 제어방법 (0) | 2021.08.03 |
---|---|
21 selectbox 값으로 for문 돌리기 (0) | 2021.08.03 |
00 jQuery 간단하게 사전처럼 찾아쓰기 (findfun 님블로그 정리) (0) | 2021.08.03 |
10 readonly, disabled 컨트롤 (0) | 2021.07.20 |
10 <li>list item 1</li>에서 $('li').eq(2).css('background-color', 'red'); (0) | 2021.07.20 |