• Страница 1 из 1
  • 1
Модератор форума: Yuri_G  
Сообщество uCoz » Архивариус » Решённые вопросы » Как добавить в input > placeholder
Как добавить в input > placeholder
mick-3k
Сообщений: 6
Репутация: 0

Сообщение # 1 | 17:54:06
Подскажите, как добавить в input, в форме редактирования персональной информации placeholder=" " id="siM60"
Yuri_G
uWeb support
uVip manager
Сообщений: 4336
Репутация: 943

Сообщение # 2 | 21:09:37
mick-3k, наведу пример как я использую placeholder в почтовых формах:
Цитата
<input type="text" name="f2" size="30" style="width:95%;" maxlength="70" placeholder="Тема">
И в дополнение скрипт:
Код
<script>
   $(function(){
   jQuery.support.placeholder = false;
   test = document.createElement('input');
   if('placeholder' in test) jQuery.support.placeholder = true;
   if(!jQuery.support.placeholder) {
   var active = document.activeElement;
   $(':text, textarea').focus(function () {
   if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
   $(this).val('').removeClass('hasPlaceholder');
   }
   };).blur(function () {
   if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
   $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');    
   }
   };);
   $(':text, textarea').blur();
   $(active).focus();
   $('form').submit(function () {
   $(this).find('.hasPlaceholder').each(function() { $(this).val(''); };);
   };);
   }
   };);
</script>
По примеру выше можно добавить placeholder и для форме редактирования персональной информации

K1l0
Сообщений: 106
Репутация: 26

Сообщение # 3 | 22:16:08

Код
$(function(){  
$('#siM60').attr({placeholder:'Тема'});
});
webanet
Сообщений: 24067
Репутация: 4985

Сообщение # 4 | 19:54:12
тест

ТУТ можно оставить своё мнение по любому вопросу
https://webanetlabs.net/
Сообщество uCoz » Архивариус » Решённые вопросы » Как добавить в input > placeholder
  • Страница 1 из 1
  • 1
Поиск: