Pourquoi toujours implémenter une grosse machine comme jquery pour récupérer une simple valeur ?
Voilà la même page avec un bouton qui affiche la valeur du premier radio. J'ai rajouté juste un petit bout de script pour afficher la valeur. Charge à toi de récupérer cette valeur.
Le getElementsByName peut être remplacé par un getElementsById pour récupérer la valeur d'un radio particulier.
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Toggle Switches</title>
<link rel="stylesheet" href="css/style.css">
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<script>
function myClick(){
var radio = document.getElementsByName("view");
var i;
for (i = 0; i < radio.length; i++){
alert(radio[i].checked);
}
}
</script>
</head>
<body>
<section class="container">
<div class="switch">
<input type="radio" class="switch-input" name="view" value="week" id="week" checked>
<label for="week" class="switch-label switch-label-off">Week</label>
<input type="radio" class="switch-input" name="view" value="month" id="month">
<label for="month" class="switch-label switch-label-on">Month</label>
<span class="switch-selection"></span>
</div>
<div class="switch switch-blue">
<input type="radio" class="switch-input" name="view2" value="week2" id="week2" checked>
<label for="week2" class="switch-label switch-label-off">Week</label>
<input type="radio" class="switch-input" name="view2" value="month2" id="month2">
<label for="month2" class="switch-label switch-label-on">Month</label>
<span class="switch-selection"></span>
</div>
<div class="switch switch-yellow">
<input type="radio" class="switch-input" name="view3" value="week3" id="week3" checked>
<label for="week3" class="switch-label switch-label-off">Week</label>
<input type="radio" class="switch-input" name="view3" value="month3" id="month3">
<label for="month3" class="switch-label switch-label-on">Month</label>
<span class="switch-selection"></span>
</div>
</section>
<section>
<button onclick="myClick()">Click me !!!</button>
</section>
<section class="about">
<p class="about-links">
<a href="
http://www.cssflow.com/snippets/toggle-switches" target="_parent">View Article</a>
<a href="
http://www.cssflow.com/snippets/toggle-switches.zip" target="_parent">Download</a>
</p>
<p class="about-author">
© 2012-2013 <a href="
http://thibaut.me" target="_blank">Thibaut Courouble</a> -
<a href="
http://www.cssflow.com/mit-license" target="_blank">MIT License</a><br>
Original PSD by <a href="
http://www.premiumpixels.com/freebies/sort-switches-toggles-psd/" target="_blank">Orman Clark</a>
</p>
</section>
</body>
</html>
--
Cordialement,
Philippe SAINT-BERTIN
Géode Informatique