[JavaScript] 文本框记住原始值的jquery代码 →→→→→进入此内容的聊天室

来自 , 2021-02-05, 写在 JavaScript, 查看 145 次.
URL http://www.code666.cn/view/b4d6f2b5
  1. var origValue = [];
  2. $('input.remember').each ( function (currentIndex)
  3. {
  4.        origValue.push ( $(this).val () );
  5.        $(this).focus ( function ()
  6.        {
  7.                $(this).removeClass("unfocused");
  8.                var defaultText = $(this).val();
  9.                if ( $(this).val () == origValue [ currentIndex ] )
  10.                {
  11.                        $(this).val('');
  12.                }
  13.  
  14.                $(this).blur(function()
  15.                {
  16.                        var userInput = $(this).val();
  17.                        if (userInput == '')
  18.                        {
  19.                                $(this).val(defaultText);
  20.                                $(this).addClass("unfocused");
  21.                        }
  22.                });
  23.        });
  24. });
  25. //javascript/4270

回复 "文本框记住原始值的jquery代码"

这儿你可以回复上面这条便签

captcha