惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
H
Hacker News: Front Page
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
Google Online Security Blog
Google Online Security Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
T
Tenable Blog
博客园 - 叶小钗
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
量子位
P
Proofpoint News Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
S
Schneier on Security
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
GRAHAM CLULEY
G
Google Developers Blog
月光博客
月光博客
V
V2EX
T
Troy Hunt's Blog
A
Arctic Wolf

博客园 - 码 头

实测有效:Win11右键默认显示更多设置教程 netcore 并发锁 多线程中使用SemaphoreSlim HTML转义字符大全 .Net Core后台任务启停(BackgroundService) 常见的JavaScript的循环处理数据方法 Linux下.NET Core进程守护设置,解决SSH关闭后.NET Core服务无法访问的问题 记录 IIS 部署vue 项目步骤 AspNetCoreApi 跨域处理(CORS ) .NET CORE 使用Session报错:Session has not been configured for this application or request 小豆苗疫苗辅助搜索 日期函数(sql) 图片javascript缩小 c# DESEncrypt 加密、解密算法 汉字编码问题转换 二分法算法 MVC拦截器记录操作用户日志 最全的Resharper快捷键汇总 如何将数据库中的表导入到PowerDesigner中 sql脚本查询日期时间段日期
修复IE9.0下PlaceHolder 属性问题js脚本
码 头 · 2015-09-15 · via 博客园 - 码 头

在开发前端系统时候碰到这种兼容问题,以下是个人解决方案,希望能给其他人带来帮助:

var JPlaceHolder = {
    //检测
    _check: function () {
        return 'placeholder' in document.createElement('input');
    },
    //初始化
    init: function () {
        if (!this._check()) {
            this.fix();
        }
    },
    //修复
    fix: function () {        
        jQuery(':input[placeholder]').each(function (index, element) {
            var self = $(this), txt = self.attr('placeholder'), atrValue = self.attr('type');

            //密码文本框
            if (atrValue == "password") {
                self.attr("type", "text");
                self.attr("pwd", "true");
            } else {
                self.attr("pwd", "false");
            }

            self.focusin(function (e) {
                var atrpwd = self.attr('pwd');
                if (atrpwd == "true") {
                    self.attr("type", "password");
                } else {
                    self.attr("type", "text");
                }
                self.val("");
            }).focusout(function (e) {
                if (!self.val()) {
                    self.attr("type", "text");
                    self.val(txt);
                }
            });
            if (self.val().length > 0) {
                self.val("");
            }
            else {
                self.val(txt);

            }

        });
    }
};
//执行
jQuery(function () {
    JPlaceHolder.init();
});