.css()
Description: Get the value of a style property for the first element in the set of matched elements.
version added: 1.0.css( propertyName )
propertyNameA CSS property.
The .css()
method is a convenient way to get a style property from the first matched element, especially in light of the different ways browsers access most of those properties (thegetComputedStyle()
method in standards-based browsers versus the currentStyle
andruntimeStyle
properties in Internet Explorer) and the different terms browsers use for certain properties. For example, Internet Explorer's DOM implementation refers to the float
property as styleFloat
, while W3C standards-compliant browsers refer to it as cssFloat
. For consistency, you can simply use "float"
and jQuery will translate it to the correct value for each browser.
Also, jQuery can equally interpret the CSS and DOM formatting of multiple-word properties. For example, jQuery understands and returns the correct value for both .css('background-color')
and .css('backgroundColor')
. Different browsers may return CSS color values that are logically but not textually equal, e.g., #FFF, #ffffff, and rgb(255,255,255).
Shorthand CSS properties (e.g. margin, background, border) are not supported. For example, if you want to retrieve the rendered margin, use: $(elem).css('marginTop')
and$(elem).css('marginRight')
, and so on.
//이메일 직접입력
$("select[name=emailType]").change(function () {
if ($(this).val() == "custom") {
$("#email_selectbox").css("display", "none");
$("#email_text").css("display", "inline");
}
});
상세 설명: http://api.jquery.com/css/