Сообщение от RodgerFox
|
Есть список радио кнопок, каждая находится в своем li, при нажатии на другой инпут или лабел класс меняется на активный у li.
|
Оно?
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!--
<link rel="stylesheet" type="text/css" href="tmp.css" />
-->
<style type="text/css">
.on {
color: red;
background-color: yellow;
}
</style>
<script type="text/javascript">
$(document).ready(function (){
$(':radio').click(function (){
var o=$(this);
$(this).parents('ul').find('.on').removeClass('on');
$(this.parentNode).addClass('on');
});
});
</script>
</head>
<body>
<article>
<ul>
<li for="id_1"><input type="radio" name='grp1' /><label> .. </label></li>
<li for="id_2"><input type="radio" name='grp1' /><label> .. </label></li>
</ul>
</article>
<article>
<ul>
<li for="id_53"><input type="radio" name='grp2' /><label> .. </label></li>
<li for="id_54"><input type="radio" name='grp2' /><label> .. </label></li>
</ul>
</article>
<article>
<ul>
<li for="id_86"><input type="radio" name='grp3' /><label> .. </label></li>
<li for="id_87"><input type="radio" name='grp3' /><label> .. </label></li>
</ul>
</article>
</body>
</html>