JJAMIL182

Tambahkan class pada tag html




DIV pertama (first DIV) berubah menjadi div.box100red
DIV kedua (second DIV) tak mengalami perubahan!
DIV ketiga (last DIV) berubah menjadi div.box100blue


Letakan kode dibawah ini pada postingan sobat
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <style type="text/css"> #oon{ width:450px; margin:20px auto; background:#aaa; border:2px solid #666; border-radius:12px; padding:20px 15px; text-align:center; } #oon div{ margin:10px auto; width:400px; height:50px; background:black; font:14px "Times New Roman", Times, serif; color:white; line-height:50px; } #oon .box100red{ margin:10px auto; height:100px; background:red; color:yellow; line-height:100px; border-radius:12px; box-shadow:0 0 8px #000; } #oon .box100blue{ margin:10px auto; height:100px; background:blue; color:black; line-height:100px; border:2px solid #eee; border-radius:20px; box-shadow:0 0 8px #000; } </style> <div id="oon"> <div>DIV pertama (first DIV) berubah menjadi div.box100red</div> <div>DIV kedua (second DIV) tak mengalami perubahan!</div> <div>DIV ketiga (last DIV) berubah menjadi div.box100blue</div> </div> <script type="text/javascript"> $("#oon div:first").addClass("box100red"); $("#oon div:last").addClass("box100blue"); </script>