JavaScript | нужна библиотека js
не хочет работать скрипт, в песочнице все ок, а в документе html не хочет я так понял нужна библиотека, какую мне нужно скачать ? пробовал эти не помогло: <script src="http://code.jquery.com/jquery-1.10.2.js"> <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"> сама песочница https://jsfiddle.net/Deonis/DptA7/
javascript
var i = 10; $('#mama').click(function(){ $that = $(this); $('#sestra').val(i++); $that.prop('disabled',true); setTimeout(function(){ $that.prop('disabled',false); }, 5000); }); <button id="mama">Кнопка</button> <input id="sestra" type="text" value="Сестра"> не хочет работать скрипт, в песочнице все ок, а в документе html не хочет я так понял нужна библиотека, какую мне нужно скачать ?
javascript
var i = 10; $('#mama').click(function(){ $that = $(this); $('#sestra').val(i++); $that.prop('disabled',true); setTimeout(function(){ $that.prop('disabled',false); }, 5000); }); <button id="mama">Кнопка</button> <input id="sestra" type="text" value="Сестра"> ________
посл. ред. 14.09.2023 в 16:17; всего 1 раз(а); by 624534626
Лучший ответ
php
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { var i = 10; $('#mama').click(function(){ $that = $(this); $('#sestra').val(i++); $that.prop('disabled',true); setTimeout(function(){ $that.prop('disabled',false); }, 5000); }); }); </script> <button id="mama">Кнопка</button> <input id="sestra" type="text" value="Сестра"> php
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { var i = 10; $('#mama').click(function(){ $that = $(this); $('#sestra').val(i++); $that.prop('disabled',true); setTimeout(function(){ $that.prop('disabled',false); }, 5000); }); }); </script> <button id="mama">Кнопка</button> <input id="sestra" type="text" value="Сестра"> после обновления страницы скрипт сбивается (((
как бы сделать так что бы таймаут сохранялся в куках например?
поможешь?
работает, но есть один минус про который я забыл, (((((
после обновления страницы скрипт сбивается (((
как бы сделать так что бы таймаут сохранялся в куках например?
поможешь?
php
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { var i = getCookie('counter') || 10; $('#sestra').val(i); $('#info').click(function() { $that = $(this); $('#sestra').val(i++); $that.prop('disabled', true); setTimeout(function() { $that.prop('disabled', false); }, 5000); setCookie('counter', i, 30); }); function setCookie(name, value, days) { var expires = ''; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = '; expires=' + date.toUTCString(); } document.cookie = name + '=' + value + expires + '; path=/'; } function getCookie(name) { var nameEQ = name + '='; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } }); </script> <button id="info">Кнопка</button> <input id="sestra" type="text" value="Сестра">
вы на доске сэр
і шо мне теперь не жить, илы не зарабативать. СЭР...
Мультиаккаунтом занимаешься, все твои ники на доске. Не умничай тут.
Стр.: 1, 2