Skip to content

Instantly share code, notes, and snippets.

@uicoded
Created September 8, 2014 00:07
Show Gist options
  • Save uicoded/428ee9f22d2a9ae36fd0 to your computer and use it in GitHub Desktop.
Save uicoded/428ee9f22d2a9ae36fd0 to your computer and use it in GitHub Desktop.
HTML - input type checkbox disabled HTML - input type checkbox disabled // source http://jsbin.com/boqeko/2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="HTML - input type checkbox disabled">
<title>HTML - input type checkbox disabled</title>
<style id="jsbin-css">
fieldset{
margin: 2em 0;
}
button{
cursor: pointer;
}
</style>
</head>
<body>
<h1>HTML - input type checkbox disabled</h1>
<form action="">
<label for="standalone">Standalone disabled checkbox</label><input id="standalone" type="checkbox" disabled>
<p><button id="flip">enable</button></p>
<fieldset>
<legend>Checkbox group</legend>
</fieldset>
</form>
<script id="jsbin-javascript">
var ch1 = document.getElementById('standalone'),
flipButton = document.getElementById('flip');
flipButton.onclick = function (){
if(ch1.disabled){
ch1.disabled = false;
this.value = 'disable';
}else{
ch1.disabled = true;
this.value = 'enable';
}
return false;
}
</script>
<script id="jsbin-source-css" type="text/css">fieldset{
margin: 2em 0;
}
button{
cursor: pointer;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">var ch1 = document.getElementById('standalone'),
flipButton = document.getElementById('flip');
flipButton.onclick = function (){
if(ch1.disabled){
ch1.disabled = false;
this.value = 'disable';
}else{
ch1.disabled = true;
this.value = 'enable';
}
return false;
}
</script></body>
</html>
fieldset{
margin: 2em 0;
}
button{
cursor: pointer;
}
var ch1 = document.getElementById('standalone'),
flipButton = document.getElementById('flip');
flipButton.onclick = function (){
if(ch1.disabled){
ch1.disabled = false;
this.value = 'disable';
}else{
ch1.disabled = true;
this.value = 'enable';
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment