textarea

cross browser nowrap textarea

你说的曾经没有我的故事 提交于 2019-12-06 22:49:43
问题 I'm looking for a cross browser solution that makes textarea : wrap text only on enter scrollbars both hidden, until text overflows I have tried almost everything can be found in SO... Failed #1: textarea{ white-space:nowrap; overflow: auto; } does not work in FF Failed #2: textarea{ white-space:nowrap; overflow: auto; // or scroll } +WRAP=OFF attribute here I cant hit enter in IE (jsFiddle) Failed #3: textarea{ white-space:pre; overflow: auto; } +WRAP=OFF attribute auto line break in IE if I

sizing a textarea with CSS vs with cols and rows

感情迁移 提交于 2019-12-06 19:19:23
问题 What's the difference between sizing a textarea with cols and rows and sizing a textarea with height and width? <textarea id="TextArea1" cols="73" rows="12">with cols rows</textarea> <textarea id="TextArea2" style="height:200px; width:600px";>with CSS</textarea> jsFiddle 回答1: cols and rows are relative to font size. height and width aren't. http://jsfiddle.net/rVUEE/1/ EDIT: Saying they are relative to "font size" is a bit too simplistic. They take into account things such as line-height and

Add a scrollbar to a <textarea> [duplicate]

拜拜、爱过 提交于 2019-12-06 18:31:52
问题 This question already has answers here : Enable vertical scrolling on textarea (5 answers) Closed 6 years ago . I would like to add a scrollbar to a textarea, so that it always appears, even when there is nothing to scroll down to. If there is nothing for it to scroll down to, I would prefer if it could be greyed out, indicating that there is nothing below. How would I do this? 回答1: What you need is overflow-y: scroll; Demo textarea { overflow-y: scroll; height: 100px; resize: none; /* Remove

JavaFX - get current word being typed in TextArea

懵懂的女人 提交于 2019-12-06 15:33:55
问题 I'm trying to get the current word or partial word currently being typed in a JavaFX TextArea to pass to to a very basic AutoComplete getPredictions(String prefix); method. Right now I am using an Event Handler on KeyTyped and I'm going to track each character typed and concatenate it with the previously typed word, resetting on a space. This is going to have a lot of pitfalls I can see with AutoComplete being turned on in the middle of typing a word, getting the previous word if backspace is

Insert text in a textarea/text input at the cursor, when code is being executed in a Chrome Extension content script

送分小仙女□ 提交于 2019-12-06 14:19:43
问题 I am making a Chrome extension that places some stored, regularly used bits of text, into text inputs and text areas when a context menu item is chosen. The way it's set up to work at the moment, there's a line in the content script which takes care of the insertion: document.activeElement.value = "TEXT TO INSERT" + document.activeElement.value ; This puts the text at the start of whichever textbox/editable area is selected. It would be desirable to insert the text wherever the user is

Separating textarea line breaks into different database rows

我的梦境 提交于 2019-12-06 13:56:19
I have a textarea form input where users input ingredients for a recipe. What I originally had was a dynamic, Javascript based 'add an ingredient' field but realised this was not good for accessibility. Originally I was separating each input field out into it's own row in my database and was wondering how I could do this with a textarea? What I assume is done is separating out each line break and placing it into it's own row in the table but I do not know the syntax for that. Further Details I'm using PHP and processing the textarea with a 'post' variable. The reason for wanting to put each

jQuery - Textarea auto grow plugin cross-browser compatible

女生的网名这么多〃 提交于 2019-12-06 13:37:24
问题 I need a cross-browser compatible plugin for textrea to be auto growing and shrinking when the inside text is getting written or deleted. I have tried the Elastic plugin and Padolsey autoresize ones. Both fails in Firefox 3.6. 回答1: I've been using the snippet at: Autogrow script @ Javascript Bindings for the Google AppEngine Data Store Project on Google Code Just in case the URL may be down or deleted, here goes the code: (function($) { /* * Auto-growing textareas; technique ripped from

Using a canvas element as a textarea

折月煮酒 提交于 2019-12-06 12:07:01
问题 I'm looking for a straight forward description of how to use a canvas element sort of like a text area. I have seen projects such as Ace. Just wondering how to go about writing to the area as if it where a textarea. Just plain text, nothing fancy. Thanks in advance. 回答1: Ace used to be Mozilla Skywriter, which used to be Mozilla Bespin. The code for Bespin is actually pretty simple to understand if you are willing to dig through it and make your own based on it, but it is sort of a fool's

Handling Enter Key on Text Area using javascript

ε祈祈猫儿з 提交于 2019-12-06 11:50:09
问题 I have 5 text areas on a page and I would like a specific event to occur on hitting the enter key on the first text area and a different event on enter key of the other text areas. Can you please suggest on how this can be acheived. <TextArea></TextArea> <TextArea></TextArea> <TextArea></TextArea> <TextArea></TextArea> <TextArea></TextArea> when hitting the enter on 1st Text Area, alert('Text Area 1 clicked'); when hitting the enter on the other 4 Text Area, alert ('Other Text Area's clicked'

How to count numbers of line in a textarea

梦想与她 提交于 2019-12-06 11:31:56
I want to make a dynamic textarea, it should increase in rows as the content increase. I am using this code: $("#text_textarea").keyup(function(e) { //splitting textarea value wrt '\n' to count the number of lines if ($(this).val().lastIndexOf('\n')!=-1) var x = $(this).val().split('\n'); $(this).attr( "rows" , x.length+1 ); }); But it fails when user continues to write without giving any new line \n (pressing Enter). var keyUpTimeout = false; // Required variables for performance var keyupTimer = 0; $("#text_textarea").keyup(function(e) { var cooldownTimeout = 500; //Set the cooldown time-out