jQueryでCSSのプロパティを変更

$(“セレクタ”).css(“プロパティ”,”値”);

$(".woman").css("color","#f00");

プロパティを複数変更する場合は、以下のいずれかを指定。

/* 1行で指定 */
$('#hoge').css({'color': 'red', 'font-weight': 'bold'});

/* 複数行で指定 */
$('#hoge').css({'color': 'red', 
                'font-weight': 'bold'});

/* 変数で指定 */
const prop  = {'color': 'red',
            'font-weight': 'bold'};
$('#hoge').css(prop);
inserted by FC2 system