标签:属性 版本 return class attr document nbsp his style
if (!placeholderSupport()) { //判断浏览器是否支持 placeholder $(‘[placeholder]‘).focus(function() { var input = $(this); if (input.val() == input.attr(‘placeholder‘)) { input.val(‘‘); input.removeClass(‘placeholder‘); } if (input[type = ‘password‘].val() == input[type = ‘password‘].attr(‘placeholder‘)) { input[type = ‘password‘].val(‘‘); input[type = ‘password‘].removeClass(‘placeholder‘); } }).blur(function() { var input = $(this); if (input.val() == ‘‘ || input.val() == input.attr(‘placeholder‘)) { input.addClass(‘placeholder‘); input.val(input.attr(‘placeholder‘)); } }).blur(); } function placeholderSupport() { return ‘placeholder‘ in document.createElement(‘input‘); }
标签:属性 版本 return class attr document nbsp his style
原文地址:https://www.cnblogs.com/newbo/p/11350880.html