Помогите со скриптом, пожалуйста.
имеется следующий код:
<html><head> <script type="text/javascript" src="jquery-1.2.6.js"></script> </head><body> <div id=myCondoms> <input type=checkbox name=activator value=1 /><select name=condoms1><option>contex</option><option>visit</option></select> </div> <script> $('div#myCondoms').find('select').attr('disabled', 'disabled'); $('input[name=activator]').click(function(e){ if (this.checked) { $('div#myCondoms').find('select').attr('disabled', 'disabled'); $('select[name=condoms'+this.value+']').removeAttr('disabled'); } }); </script> </body></html> Когда ставлю флажок то список select разблокируется и можно выбрать необходимый элемент из списка! Подскажите, пож-та, а как сделать, чтобы при снятии флажка, список select опять блокировался!? |
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<div id=myCondoms>
<input type=checkbox name=activator value=1 />
<select name=condoms1 disabled='disabled'><option>contex</option><option>visit</option></select>
</div>
<script>
var select = $('div#myCondoms').find('select');
$('input[name=activator]').toggle(function(){
select.attr('disabled', '');
},function(){
select.attr('disabled', 'disabled');
});
</script>
</body>
</html>
|
| Часовой пояс GMT +3, время: 11:05. |