"JavaScript 버튼 비활성화"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(사용자 3명의 중간 판 26개는 보이지 않습니다)
5번째 줄: 5번째 줄:


==예제 1: HTML==
==예제 1: HTML==
*http://jmnote.com/html5/button-disabled.php
*http://zetawiki.com/ex/html5/button-disabled.php
<source lang='html5'>
<syntaxhighlight lang='html5'>
<button onclick="alert('Hello');">Say Hello</button>
<button onclick="alert('Hello');">Say Hello</button>
<button onclick="alert('World');" disabled='disabled'>Say World</button>
<button onclick="alert('World');" disabled='disabled'>Say World</button>
</source>
</syntaxhighlight>


==예제 2: JavaScript==
==예제 2: JavaScript==
*http://jmnote.com/js/button-disabled.php
*http://zetawiki.com/ex/js/button-disabled.php
<source lang='html5'>
<syntaxhighlight lang='html5' highlight='5'>
<button onclick="alert('Hello');">Say Hello</button>
<button id="btn-hello" onclick="alert('Hello');">Say Hello</button>
<button onclick="alert('World');" disabled='disabled'>Say World</button>
<button id="btn-world"  onclick="alert('World');">Say World</button>
</source>
<script>
 
var btn = document.getElementById('btn-world');
==예제 2: jQuery==
btn.disabled = 'disabled';
*http://jmnote.com/jq/button-disabled.php
</script>
<source lang='html5'>
</syntaxhighlight>
<button onclick="alert('Hello');">Say Hello</button>
<button onclick="alert('World');" disabled='disabled'>Say World</button>
</source>


==같이 보기==
==같이 보기==
*[[버튼]]
* [[버튼]]
* [[getElementById]]
* [[jQuery 버튼 비활성화]]


[[분류: HTML]]
[[분류: JavaScript]]
[[분류: jQuery]]
[[분류: jQuery]]
[[분류: 버튼]]

2020년 11월 2일 (월) 02:51 기준 최신판

1 개요[ | ]

HTML button disabled
HTML 버튼 비활성화
  • 버튼이 비활성화되면 onclick도 작동하지 않게 된다.

2 예제 1: HTML[ | ]

<button onclick="alert('Hello');">Say Hello</button>
<button onclick="alert('World');" disabled='disabled'>Say World</button>

3 예제 2: JavaScript[ | ]

<button id="btn-hello" onclick="alert('Hello');">Say Hello</button>
<button id="btn-world"  onclick="alert('World');">Say World</button>
<script>
var btn = document.getElementById('btn-world');
btn.disabled = 'disabled';
</script>

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}