Сообщение от Григорий Данилович
|
Я нашёл на инете:
var s=$("input:radio[name=sops]");
game.sops=s.val();
game.picform=s.attr('f');
Тоже не работает.
|
Потому как нужно понимать с каким количеством элементов ты имеешь дело.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<script src='http://code.jquery.com/jquery-latest.js'></script>
<!--
<script src="https://code.angularjs.org/1.3.9/angular.min.js"></script>
<script src="https://code.angularjs.org/1.3.9/angular-route.js"></script>
-->
<style type='text/css'>
</style>
<script type='text/javascript'>
$(function(){
alert($("input:radio[name=sops]").length);
alert($("input:radio[name=sops]:checked").length);
});
</script>
</head>
<body>
<input type=radio name="sops" value='1' f='jpg' id='s1' checked='yes'>
<input type=radio name="sops" value='2' f='jpg' id='s2'>
<input type=radio name="sops" value='3' f='png' id='s3'>
</body>
</html>