Created
June 12, 2014 02:52
-
-
Save alanerzhao/9a476f3463628833d28c to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
<label for="EMAIL"> <input type="radio" id="EMAIL" name="contact_type" value="1"><span>邮箱 </span></label> | |
<label for="QQ"> <input type="radio" id="QQ" name="contact_type" value="2"><span>QQ</span></label> | |
<label for="PHONE"> <input type="radio" id="PHONE" name="contact_type" value="3"><span>电话</span></label> | |
<label for="OTHER"> <input type="radio" id="OTHER" name="contact_type" value="4"><span>其它</span></label> | |
<button>ok</button> | |
<script src="./js/jquery.js"></script> | |
<script> | |
var radioOpt = $("input[name='contact_type']"); | |
$("button").click(function () { | |
var power = false; | |
var text = ''; | |
radioOpt.each(function (idx,obj) { | |
if($(obj).is(":checked")) { | |
power = true; | |
text = $(this).val(); | |
return false; | |
} else { | |
power = false; | |
} | |
}) | |
console.log(power,text) | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment