我设置了text-security:disc;以下面的方式但它不能在Firefox中工作.
text-security:disc; -webkit-text-security:disc; -mox-text-security:disc;
我将这些属性设置为输入[type =’number’]字段.有什么建议吗?
解决方法
window.onload = function() { init(); } function init() { var x = document.getElementsByTagName("input")[0]; var style = window.getComputedStyle(x); console.log(style); if (style.webkitTextSecurity) { // Do nothing } else { x.setAttribute("type","password"); } }
CSS
input { text-security: disc; -webkit-text-security: disc; -moz-text-security: disc; }