textarea

Apply different styles to strings in a single TextArea in JavafX

≡放荡痞女 提交于 2019-12-17 14:53:14
问题 Is there a way to style a substring of the text in a TextArea ? setStyle() method is only available to the TextArea class. 回答1: If you are using JDK 8, then this can be achieved by using RichTextFX. It allows you to add style classes to text ranges. 来源: https://stackoverflow.com/questions/20386132/apply-different-styles-to-strings-in-a-single-textarea-in-javafx

Find caret position in textarea in pixels [duplicate]

冷暖自知 提交于 2019-12-17 12:03:14
问题 This question already has answers here : How do I get the (x, y) pixel coordinates of the caret in text boxes? (3 answers) Closed 5 years ago . I was wondering if it is possible to find the exact location of the carret inside a textarea in pixels in relation to the entire page. For instance, if I have typed This is text into my text box, I would like to know the pixes from the top left of the screen to the carot. It would be in the form X: 200 Y: 100. This is so I can position a floating div.

Textarea value not getting posted with form

天涯浪子 提交于 2019-12-17 10:56:29
问题 I'm trying to input a textarea tag when I submit my form: <textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea> <form action="sendConfirmation.php" name="confirmationForm" method="post"> <input type="submit" value="Email" class="submitButton"> </form> As you can see I've set the form="confirmationForm" attribute in my textarea tag. I've used Live HTTP Headers to catch the POST request and it is empty (so I know the

CSS Textarea that expands as you type text

泄露秘密 提交于 2019-12-17 10:32:48
问题 I have a Textarea where users can input text. By default it has a height of 17px. However if users insert a large amount of text, I want the text area to expand accordingly. Is there a way to do this with CSS ? Thanks in advance!! 回答1: This cannot be done with CSS alone. try the autogrow jquery plugin. https://github.com/jaz303/jquery-grab-bag/blob/master/javascripts/jquery.autogrow-textarea.js You can also see autogrow demo here http://onehackoranother.com/projects/jquery/jquery-grab-bag

The .val() of a textarea doesn't take new lines into account

纵饮孤独 提交于 2019-12-17 09:45:17
问题 The .val() property of an item in jQuery for a <textarea> doesn't seem to work with new lines. I need this function as the text-area is meant to recognize the enter key and display it as a preview, with the new line in tact. However, what happens is shown in this fiddle: http://jsfiddle.net/GbjTy/1/. The text is displayed, but not in a new line. How can I achieve the preview to include new lines, and I know it is possible, because it does this in the Stack Overflow Post Question preview.

How to set maxlength attribute on h:inputTextarea

点点圈 提交于 2019-12-17 09:42:19
问题 How can I limit the length of <h:inputTextarea> ? For <h:inputText> it works fine with maxlength attribute. However, this attribute is unavailable in <h:inputTextarea> . 回答1: HTML5 + JSF 2.2+ If you're using HTML5 and JSF 2.2+, specify it as a passthrough attribute. <html ... xmlns:a="http://xmlns.jcp.org/jsf/passthrough"> <h:inputTextarea value="#{bean.text}" a:maxlength="2000" /> HTML5 + JSF 2.0/2.1 If you're using HTML5, but not JSF 2.2 yet, use OmniFaces Html5RenderKit to recognize new

Finding number of lines in an html textarea

流过昼夜 提交于 2019-12-17 09:34:27
问题 I'm writing a mobile web application where scrollbars are not displayed on the device's browser. Due to this, I'm trying to dynamically modify the height of the textarea to make it bigger, however I don't know of any way to actually get the line count on an html textarea. Any help would be greatly appreciated! EDIT So I realize now that it's not newlines per se, but actual line wrapping. So when one line finishes it wraps the text to the next line. It appears as if it is a new line. Any way

HTML Textarea horizontal scroll

五迷三道 提交于 2019-12-17 08:54:27
问题 I would like to provide a horizontal scroll to a textarea in my HTML page. The scroll should appear without wrapping, if I type a long line without a line break. A few friends suggested using overflow-y CSS attribute, which did not work for me. The browsers that I use are IE 6+ and Mozilla 3+. 回答1: To set no wrapping, you would use: white-space: nowrap; For other values: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space NOTE: However the depreciated wrap="off" seems to be the only

Is there a way to make a text area partially editable? (make only portions of the text editable)

孤人 提交于 2019-12-17 06:46:36
问题 I just came across a situation in which it would be an elegant solution to have only portions of a text area (previously loaded with text) be editable while other portions are not ("greyed out", so to speak). Is this possible at all by using javascript in general? I would be using jQuery. 回答1: You could do this (just an outlined idea, no code): Devise a regex that matches your entire text. Use fixed strings for the unmodifiable parts, and use [\s\S]*? for the modifiable parts. Use ^ and $ to

Get the offset position of the caret in a textarea in pixels [duplicate]

一曲冷凌霜 提交于 2019-12-17 06:39:32
问题 This question already has answers here : How do I get the (x, y) pixel coordinates of the caret in text boxes? (3 answers) Closed 5 years ago . In my project I'm trying to get the offset position of the caret in a textarea in pixels. Can this be done? Before asking here, I have gone through many links, especially Tim Down's, but I couldn't find a solution which works in IE8+, Chrome and Firefox. It seems Tim Down is working on this. Some other links which I have found have many issues like