본문 바로가기

   
Programming/Jquery

jQuery eq 태그를 활용한 태그 삭제

반응형

jQuery eq 태그를 활용한 태그 삭제

소스

<html>

       <head>

             <title></title>

             <meta name="generator" content="editplus" />

             <meta name="author" content="zzarungna" />

             <script type="text/javascript" src="jquery-1.7.1.js"></script>

             <script type="text/javascript">

                    function Select() {

                           // ':' 필터(filter)

                           //$("#list1 li").css("color", "red");

                           //$("#list1 li:first").css("color","orange");

                           //$("#list1 li:last").css("color","orange");

                           //$("#list1 li:last").css("display","none");

                           $("#list1 li:eq(1)").css("color", "white");

                    }

             </script>

       </head>

 

       <body>

             <ol id="list1">

                    <li>첫번째 항목</li>

                    <li>두번째 항목</li>

                    <li>세번째 항목</li>

                    <li>네번째 항목</li>

             </ol>

             <hr />

             <input type="button" value="선택" onclick="Select()" />

       </body>

</html>

 

결과화면


 


반응형