开发者

how to hide the blinking cursor in a text field

hello I'm trying a text box expand and collapse option, the text box expand while clicking on it, and collapse while clicking again on it, there is a placeholder in it, while I'm trying to click again in the text box the blinking cursor appears on the placeholder. please help me to hide the blinking cursor in the text field.

The 开发者_运维百科code for this is:

<@spring.formTextarea "messageWallMessage.messageText", "rows=1 cols=1 style='font-size:11px;color:#666666;width:650px; min-height:28px; padding:0 0 0px 1px;margin: 6px 0 -6px 10px;' onkeyup='return showLinkedIcon();' onFocus='if(this.value == 'What\'s on your mind?') { this.value='';showLinkedIconPublish();return false;}' onBlur='return publishMsg();' onClick='return showLinkedIconPublish();'spellcheck='false'"/>


One solution is to have the textarea immediately call blur() when it gains focus while you want the cursor to be suppressed. You will of course need to add logic to prevent this behavior once you want the textarea to become selectable.

Here's a basic example: http://jsfiddle.net/3V8F6/1/


Unfortunately, it does not appear that you can alter the look of the text cursor without changing the look of the text along with it. The two are one in the same and part of the way the OS handles text in general (as far as I can tell).

You could make your text white to hide the cursor until someone starts typing, but I'm sure you were hoping for a better solution than that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜