Created
November 18, 2015 11:58
-
-
Save naoaki011/45fd3cfc1432932ad253 to your computer and use it in GitHub Desktop.
radio の readonly処理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html><meta charset=UTF-8><title>input type=radio readonly without disabled</title> | |
<link rel=stylesheet href=https://cdn.jsdelivr.net/pure/0.6.0/pure-min.css> | |
<style>body { margin: 8px; font-size: large }</style> | |
<script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js></script> | |
<script> | |
jQuery(function($) { | |
$('input[type="radio"][data-readonly]') | |
.on("click", function() { $(this).prop("checked", false) }); | |
}); | |
</script> | |
<p> | |
<input type=radio name=name1 value=a id=name1-1 data-readonly> <label for=name1-1>A</label><br> | |
<input type=radio name=name1 value=b id=name1-2 > <label for=name1-2>B</label><br> | |
<input type=radio name=name1 value=c id=name1-3 data-readonly> <label for=name1-3>C</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment