caret

Can I change the blinking caret in a form/text area in a browser? [duplicate]

时光毁灭记忆、已成空白 提交于 2019-11-28 03:49:11
问题 This question already has answers here : How to use this square cursor in a HTML input field? (5 answers) Closed 3 years ago . I want to have a custom text caret in my text field for my web page. I would like to have an old school block type blinking caret. Is this possible? 回答1: The simple answer is you can't (change the user's blinking caret) via javascript, html, or css as that is created and managed by the chrome (the browser beyond the DOM) Wanna fake it? http://www.dynamicdrive.com

Set the caret position always to end in contenteditable div [duplicate]

佐手、 提交于 2019-11-27 23:01:53
This question already has an answer here: How to move cursor to end of contenteditable entity 6 answers contenteditable, set caret at the end of the text (cross-browser) 3 answers In my project, I am trying to set the caret position always to the end of the text. I know this is default behaviour but when we add some text dynamically, then the caret position changes to starting point in Chrome and firefox (IE is fine, amazing). Anyway to make it to work properly in chrome and firefox? Here is the fiddle <div id="result" contenteditable="true"></div> <button class="click">click to add text<

Placeholder in contenteditable - focus event issue

徘徊边缘 提交于 2019-11-27 19:46:30
问题 I have been trying to ask this before, without any luck of explaining/proving a working example where the bug happens. So here is another try: I’m trying to replicate a placeholder effect on a contenteditable DIV. The core concept is simple: <div contenteditable><em>Edit me</em></div> <script> $('div').focus(function() { $(this).empty(); }); </script> This can sometomes work, but if the placeholder contains HTML, or if there some other processing being made, the editable DIV’s text caret is

Caret position in pixels in an input type text (not a textarea) [duplicate]

这一生的挚爱 提交于 2019-11-27 19:21:57
This question already has an answer here: How do I get the (x, y) pixel coordinates of the caret in text boxes? 3 answers UPDATE : duplicate of Get cursor or text position in pixels for input element . TL; DR - use the incredibly lightweight and robust textarea-caret-position Component library, which now supports <input ype="text"> as well. Demo at http://jsfiddle.net/dandv/aFPA7/ Is there a way to know where the caret is inside an HTML text field? <input type='text' /> I would like to position in pixels (and reposition) a div depending on the position of the caret. Note : I don't want to know

How to override DefaultCaret#setBlinkRate()

依然范特西╮ 提交于 2019-11-27 16:19:16
I have an problem with Caret, Caret didn't blink without focusGained(see code in Swing Action) to 2nd. JTextField and back to 1st. JTextField how to override DefaultCaret#setBlinkRate() correctly (without override Caret) by default is Caret at the end of Document and blinking on 1st. focusGained tested on win7_32b, Java7.011/025 / Java6 tested with a few Standard L&Fs, custom too, every caused with the same issue please see for more details my answer to question How to retain selected text in JTextField when focus lost? and possible workaround by @kleopatra my SSCCE import java.awt.*; import

How do you match a caret (^) symbol in regex?

…衆ロ難τιáo~ 提交于 2019-11-27 16:02:39
I know these won't do it and also why, but how do you match it? /^/ /(^)/ /[^]/ Escape it with a backslash: /\^/ This will make it be interpreted as a literal ^ character. I think this works (I've tested this in java): \\^ '\' is used as an escape character, so you first escape '^', then you escape '\' itself you can find more information here: http://www.regular-expressions.info/characters.html 来源: https://stackoverflow.com/questions/5524583/how-do-you-match-a-caret-symbol-in-regex

Java: column number and line number of cursor's current position

青春壹個敷衍的年華 提交于 2019-11-27 15:02:05
问题 I want to know the column number and row number where the cursor in JTextArea. ie. in notepad when i m at first line than status bar shows Ln 1, Col 1. thanks in advance... 回答1: Here is the code import java.awt.BorderLayout; import javax.swing.*; import javax.swing.event.*; public class caretDemo extends JFrame { // Two controls, one is the editor and the other is our little status bar at the bottom. // When we update the editor, the change in caret will update the status text field. private

Remove text caret/pointer from focused readonly input

北战南征 提交于 2019-11-27 10:28:10
问题 I am using an <input readonly="readonly"> , styled as normal text to remove the appearance of an interactive field, but still display the value. This is very useful to prevent a user from editing a field, while still being able to post the value. I realize this is a convenience method and that there are several workarounds, but I want to use this method. Problem: The blinking caret still appears when the field is clicked/focused. (At least in FF and IE8 on Win7) Ideally, I would like it to

How can I get the element the caret is in with Javascript, when using contentEditable?

混江龙づ霸主 提交于 2019-11-27 08:15:45
Let's say I have some HTML code like this: <body contentEditable="true"> <h1>Some heading text here</h1> <p>Some text here</p> </body> Now the caret (the blinking cursor) is blinking inside the H1 element, let's say in the word "heading". How can I get the name of the element the caret is in with JavaScript? Here I would like to get "h1". This needs to work only in WebKit (it's embedded in an application). It should preferably also work for selections. You Firstly, think about why you're doing this. If you're trying to stop users from editing certain elements, just set contenteditable to false

Styling text input caret

筅森魡賤 提交于 2019-11-27 07:45:34
问题 I want to style the caret of a focused <input type='text'/> . Specifically, the color and thickness. 回答1: If you are using a webkit browser you can change the color of the caret by following the next CSS snippet. I'm not sure if It's possible to change the format with CSS. input, textarea { font-size: 24px; padding: 10px; color: red; text-shadow: 0px 0px 0px #000; -webkit-text-fill-color: transparent; } input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #ccc; text