Anda dapat menetapkan beberapa properti CSS sekaligus menggunakan sintaks objek JSON: css({'color': 'red', 'font-size': '20px'}).
jQuery css()
Contoh Kode jQuery jQuery css():
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
</head>
<body style="font-family: sans-serif; padding: 20px;">
<h3 id="judulCss">Kustomisasi CSS Instan</h3>
<button id="btnUbahCss">Ubah Gaya CSS</button>
<script>
$('#btnUbahCss').click(function() {
$('#judulCss').css({
'color': '#00758f',
'font-size': '28px',
'border-bottom': '2px solid #00758f'
});
});
</script>
</body>
</html>
Uji interaksi jQuery di atas dan amati animasi efek DOM secara langsung.