<form id="loginFrm" role="form" method="post" novalidate="novalidate"> <input type="text" class="form-control" name="username" id="username" placeholder="电子邮箱"> <div class="form-group"> <input type="text" class="form-control" name="username" id="username" placeholder="电子邮箱"> <i class="icon icon-user"></i> <!-- 错误信息 popover --> <div class="err-popover-out"> <div class="err-popover"> <div class="tri-right"></div> <div class="tri-right-in"></div> <div class="err-popover-content"></div> </div> </div> <!-- 错误信息 popover end --> </div> <div class="form-group"> <input type="password" class="form-control" id="password" name="password" placeholder="密码"> <i class="icon icon-lock"></i> <!-- 错误信息 popover --> <div class="err-popover-out"> <div class="err-popover"> <div class="tri-right"></div> <div class="tri-right-in"></div> <div class="err-popover-content"></div> </div> </div> <!-- 错误信息 popover end --> </div> <div class="form-group clearfix"> <div class="form-left"> <input type="text" class="form-control" id="ccap-text" name="ccap" placeholder="验证码"> <i class="icon icon-shield"></i> </div> <div class="form-right"> <img class="ccap" src="/getccap?0006851273356005549"> </div> <!-- 错误信息 popover --> <div class="err-popover-out"> <div class="err-popover"> <div class="tri-right"></div> <div class="tri-right-in"></div> <div class="err-popover-content"></div> </div> </div> <!-- 错误信息 popover end --> </div> <div class="checkbox"> <label class="a" for="rem_me"> <input type="checkbox" id="rem_me" class="auto">记住我 </label> <a href="/retrieve" class="pull-right a">忘记密码?</a> </div> <button type="submit" id="submit" class="btn btn-blue form-control"><span>登录</span></button> <div class="checkbox no-padding"> <a href="/reactive" class="a text-center">重发激活邮件</a> </div> </form>
(function($) { $.fn.placeholder = function() { if (!Modernizr.input.placeholder) { $(‘[placeholder]‘).focus(function() { var input = $(this); if (input.attr(‘type‘) !== ‘password‘ && input.attr(‘placeholder‘) != 0) { if (input.val() == input.attr(‘placeholder‘)) { input.val(‘‘); input.removeClass(‘placeholder‘); } } }).blur(function() { var input = $(this); if (input.attr(‘type‘) !== ‘password‘ && input.attr(‘placeholder‘) != 0) { if (input.val() === ‘‘ || input.val() === input.attr(‘placeholder‘)) { input.addClass(‘placeholder‘); input.val(input.attr(‘placeholder‘)); } } }).blur().parents(‘form‘).submit(function() { $(this).find(‘[placeholder]‘).each(function() { var input = $(this); if(input.attr(‘type‘) !== ‘password‘ && input.attr(‘placeholder‘) != 0){ if (input.val() == input.attr(‘placeholder‘)) { input.val(‘‘); } } }); }); } }; })(jQuery);
时间: 2024-10-28 21:36:43