Есть сие чудо:
Спойлер (Отобразить)
CODE (html):
скопировать код в буфер обмена
скопировать код в буфер обмена
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" lang="ru" xml:lang="ru">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>jQuery</title>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript">
- $(function() {
- $('.chk').click(function() {
- var len = $('.chk:checked').length;
- if (len == 3)
- $('.chk:not(:checked)').attr('disabled','disabled');
- else
- $('.chk:not(:checked)').removeAttr('disabled');
- });
- });
- </script>
- </head>
- <body>
- <input type="checkbox" class="chk" value="1" />1<br>
- <input type="checkbox" class="chk" value="2" />2<br>
- <input type="checkbox" class="chk" value="3" />3<br>
- <input type="checkbox" class="chk" value="4" />4<br>
- <input type="checkbox" class="chk" value="5" />5<br>
- <input type="checkbox" class="chk" value="6" />6<br>
- <input type="checkbox" class="chk" value="7" />7<br>
- <input type="checkbox" class="chk" value="8" />8<br>
- </body>