this.value = this.placeholder || this.getAttribute('placeholder')

this.value = this.placeholder || this.getAttribute('placeholder')

鉴于不同的浏览器对为止属性的实现方式有所不用,这里同时使用了HTML DOM的placeholder属性和DOM的getAttribute('placeholder')方法

原文地址:https://www.cnblogs.com/cnundefined/p/placeholder.html