javascript 에서 동적으로 css 속성 주기

script 2014. 1. 10. 16:04


[출처] http://stackoverflow.com/questions/14477746/jquery-css-dynamically-change-attributes-of-a-class



html:

<p class="myClass">
    What?
</p>
<p class="myClass">
    Now?
</p>

css:

.myClass{
    background-color: #ffff00;    
}

js:

$(".myClass").css("background-color", "#00FFFF");
$("p").last().after("<div class='myClass'>Now!</div>");




Trackbacks 0 : Comments 0

Write a comment