textarea

Fetching cursor location and highlighted text in textarea using JQuery

大憨熊 提交于 2019-12-11 13:03:35
问题 Having a textarea in a form I am trying to do several things: fetch the current location of the cursor within the text area fetch the current selection within the textarea insert some text at the current cursor location replace the current selection by some other text As I am already using JQuery, I'd prefer a solution that works smoothly with that. Any pointers how to achieve the above would be appreciated. 回答1: There are many jQuery plugins for this. Here's a good one I've used before: http

load html file as initial content in tinymce editor

旧时模样 提交于 2019-12-11 13:02:58
问题 I have set up tinymce in my asp.net mvc project. I want to load a html file into TinyMCE editor content, which is located at another destination. I followed the tiny Documentation but it is a bit confusing to give a path to my html file. tinyMCE.activeEditor.setContent('<span>some</span> html'); this is my cshtml file @{ } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>TinyMCE Example</title> <!-- TinyMCE Script Reference --> <script src="~/scripts

loading text into textarea based on drop down selection

喜欢而已 提交于 2019-12-11 12:40:31
问题 To start, I have searched the site and found this: How to fill in a text field with drop down selection but it did not suit my needs, as I'm generating very long templates and the above method would be too time consuming and impractical as it would mean filling in the value attribute of each <option> tag with my templates. So here's the code: <script type="text/javascript"> //<![CDATA[ function showCSTemplates(sel){ locations =[ "", /*this remains blank for first selection in drop-down list*/

Textarea with horizontal rule showing up on print

陌路散爱 提交于 2019-12-11 12:24:08
问题 I am currently working on a website where a user can look at a mechanical request by a customer on the site. They can then print the request. I am trying to add a "notes" section to the request only on the printed version. I am using bootstrap, so hiding it until print is easy. My problem is that I want to have horizontal lines in the textarea, exactly like this answer: <textarea> with horizontal rule The lines work great on the the textarea. The problem is that they do not show up when

Displaying MathML symbols inside a textarea

﹥>﹥吖頭↗ 提交于 2019-12-11 11:57:54
问题 I'm building what is basically a mathematic text editor in an HTML file. My goal is to allow the user to display numbers and MathML symbols in a textarea, but completely without the use of a physical keyboard. On the bottom of the page I have a mock keyboard made of buttons with numbers and arithmetic symbols. When the user clicks these buttons, the corresponding number or symbol will then appear inside the textarea. So far, I can get this to work with numbers, but not the MathML symbols. Is

Flex: How to change caret (text cursor) in editable text area / text input

好久不见. 提交于 2019-12-11 11:54:48
问题 I need to put together an editable text area that has a custom caret (cursor) which is different from the default blinking vertical line. Is the caret a "skinnable" property of text input? Please note that I am not asking about the mouse pointer cursor which can be set using the CursorManager. Thanks. -Raj 回答1: No, the look and behaviour of the caret is controlled by the Flash player itself. There is no programmatic access to it. 来源: https://stackoverflow.com/questions/1785535/flex-how-to

Why does this textarea appear to only add one space instead of four?

假装没事ソ 提交于 2019-12-11 11:53:02
问题 Here is my code: doc.on("keydown", ".textarea_code_snippet", function(e) { if(e.keyCode === 9) { // tab was pressed // get caret position/selection var start = this.selectionStart; var end = this.selectionEnd; var $this = $(this); var value = $this.val(); // set textarea value to: text before caret + tab + text // after caret $this.val(value.substring(0, start) + "\t" + value.substring(end)); // put caret at right position again (add one for the tab) this.selectionStart = this.selectionEnd =

Javascript for loop to change the name of textareas in a function

点点圈 提交于 2019-12-11 11:49:48
问题 I have created 50 textareas with names def1,def2,def3.....,def50 . In my body onLoad() function,I want the same value is set in all these textboxes. Instead of writing the code 50 times, How can I write some Javascript code to set the value of the textarea , ie in a loop? 回答1: I suggest to read the MDC JavaScript guide, as loops and string concatenation are fairly basic operations: for(var i = 1; i < 51; i++) { var nameOfTextarea = 'def' + i; // ... } 回答2: I would give your textboxes ID's

How to open Text Input Dialog Box, when a TextArea gets focus in Javafx?

隐身守侯 提交于 2019-12-11 11:27:21
问题 I have tried the following code, to open a text input dialog box, whenever the textarea gets focused. TextArea address = new TextArea(); address.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldPropertyValue, Boolean newPropertyValue) { if (newPropertyValue) { System.out.println("Textfield on focus"); TextInputDialog dialog = new TextInputDialog("walter"); dialog.setTitle("Text Input Dialog");

cursor out of control in textarea on IOS8 safari

╄→гoц情女王★ 提交于 2019-12-11 10:27:28
问题 cursor is not in textarea when user input long text or input some enter. This only happens on IOS8. see attachment. 回答1: find a wordaround to resolve the problem. textarea.addEventListener('scroll', function(evt){ evt = evt || window.evt; evt.target.setSelectionRange(evt.target.textLength - 1, evt.target.textLength - 1); setTimeout(function(){ evt.target.setSelectionRange(evt.target.textLength, evt.target.textLength); }, 0); }); 来源: https://stackoverflow.com/questions/31376906/cursor-out-of