Snippet

Obtenez CSS Value JQuery

5 réponses de la communauté

$('#element').css('display', 'block'); /* Single style */
$('#element').css({'display': 'block', 'background-color' : '#2ECC40'}); /* Multiple style */ 
//Set one style attribute
$('#element').css('display', 'block');
//Set multiple style attributes
$('#element').css({'display': 'block', 'background-color' : '#2ECC40'}); /* Multiple style *
$('#yourElement').css('display', 'none');
var font-size = $('p').css('font-size');
console.log(font-size);
Syntax:
$(selector).css(property-name:property-value);

Example:
$('.bodytext').css('color':'red');