[英]Remove text cursor to input with Jquery
when I do focus on an input当我专注于输入时
$('#bar input').focus(function(){
// code code
});
in the input appears the text cursor... and the only way to remove it (so like the input it not focus) is to click in another part of document...在输入中出现文本光标......而删除它的唯一方法(所以就像输入它不是焦点)是单击文档的另一部分......
with jquery how i can remove the text cursor ?使用 jquery 如何删除文本光标?
i tried this:我试过这个:
$('#bar input').off('focus');
but this remove listener not text cursor但这删除了侦听器而不是文本光标
thanks!谢谢!
$('#bar input').on('focus', function(e) {
e.preventDefault();
$(this).blur();
}
This code disables the focus.此代码禁用焦点。 But it's better if you make a disabled input.
但是如果你做一个禁用的输入会更好。
<input disabled="disabled" type="text">
You can do it easily with css like the code below.您可以像下面的代码一样使用 css 轻松完成。
#bar input{ color : transparent; text-shadow : 0 0 0 #000; } #bar input:focus{ outline : none; }
<div id="bar"> <input type="text"/> </div>
Hope this will help you.希望这会帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.