본문 바로가기

개발하자/jQuery

원하는 태그의 css값 얻어오기

<html>
 <head>
 <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
 <script>

 $(document).ready(function(){

 $($("font")[0]).css("background","red");
 $($("font")[1]).css({
 background:"green",
 border:"2px solid navy"
 });
alert( $($("font")[0]).css("background"));//인자값 한개는 값얻어오는것
 });

 </script>
 </head>
 <body>
 <font>aaa</font>
 <div>bbb</div>
 <font>ccc</font>
 <div>ddd</div>
 </body>
</html>