반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- SpringBoot
- centos7
- Push
- Next.js
- Eclipse
- pwa
- spring3
- mysql
- MSsql
- security
- nodejs
- javascript
- MariaDB
- docker
- mybatis
- popup
- git
- rocky9
- Tomcat
- config
- jquery
- Maven
- node.js
- yona
- jenkins
- ajax
- Java
- FCM
- PM2
- NextJS
Archives
- Today
- Total
목록jquery li each (1)
종이 한장 차이...
jquery li each 사용 Attribute 참조하기.
1번 2번 3번 4번 5번 6번 위와 같은 li리스트가 있을 경우 아래와 같이 li의 attribute를 참조하여 class가 "top" 인 모든 li를 each로 돌면서 li의 data-top이 "2" 인 것의 data-name값을 콘솔에 찍는다. $('li[class="top"]').each(function(index,item){ if(item.getAttribute("data-top") == '2'){ console.log(item.getAttribute("data-name").trim()); } }); 위의 결과로 "2번"이 출력 된다. //li선택자를 여러개 줄경우 $('li[class="top"][data-top="1"][data-name="2번"]') //li의 가장 첫번째의 span에 cl..
javascript
2021. 1. 12. 14:23