JavaScript & JQuery
[JQuery] disabled 속성을 통해 활성화, 비활성화 설정하기
그라냐
2015. 4. 2. 16:05
@ disabled 속성의 값 가져와 비활성화 되어 있는지 확인하기 비활성화 되어 있다면 isDisabled의 값은 disabled
var isDisabled = $("#editBox").attr("disabled");
@ disabled 속성 설정하기 true면 비활성화 false면 활성화
$("#editBox").attr("disabled", true); //비활성화
$("#editBox").attr("disabled", false); //활성화
Syntax
Return the value of an attribute:
$(selector).attr(attribute)
Set the attribute and value:
$(selector).attr(attribute,value)
Set attribute and value using a function:
$(selector).attr(attribute,function(index,currentvalue))
Set multiple attributes and values:
$(selector).attr({attribute:value, attribute:value,...})
Parameter | Description |
---|---|
attribute | Specifies the name of the attribute |
value | Specifies the value of the attribute |
function(index,currentvalue) | Specifies a function that returns the attribute value to set
|