n3o*_*3on 46
我的没有插入符号:
<input type="text" value="test" readonly="readonly" >
Run Code Online (Sandbox Code Playgroud)
看看这个:http://www.cs.tut.fi/~jkorpela/forms/readonly.html
对不起,现在我明白了你的问题.
试试这个:
<input type="text" value="test" onfocus="this.blur()" readonly="readonly" >
Run Code Online (Sandbox Code Playgroud)
小智 9
你可以在你的CSS中使用它,但它不会集中注意力:
[readonly='readonly'] {
pointer-events: none;
}
Run Code Online (Sandbox Code Playgroud)
小智 6
您可以通过将css属性指定为transparent来删除闪烁的插入符
caret-color: transparent;
Run Code Online (Sandbox Code Playgroud)
你可以在这里测试结果
它可以使用 html 和 javascript 完成
<input type="text" onfocus="this.blur()" readonly >
Run Code Online (Sandbox Code Playgroud)
或 jQuery
$(document).on('focus', 'input[readonly]', function () {
this.blur();
});
Run Code Online (Sandbox Code Playgroud)