textarea

HTML 5 中的textarea标签

房东的猫 提交于 2019-12-05 15:34:08
HTML 5 中的textarea标签 定义和用法 定义一个文本区域 (text-area) (一个多行的文本输入区域)。用户可在此文本区域中写文本。在一个文本区中,您可输入无限数量的文本。文本区中的默认字体是等宽字体 (fixed pitch)。 例子 <textarea rows="3" cols="30"> 这里是文本域中的文本 ... ... ... ... </textarea> 属性 全局属性 标签支持 事件属性 标签支持 来源: https://www.cnblogs.com/jie9527-/p/11931469.html

Add new line character to textarea instead of submitting form

≯℡__Kan透↙ 提交于 2019-12-05 13:32:32
问题 I have a form with a text area and hitting the enter key submits my form. How can I make it to add a new line character instead of a form submit. 回答1: $('textarea').keypress(function(event) { if (event.which == 13) { event.stopPropagation(); } });​ JSFiddle Demo 回答2: This should help $('#myProblematicForm textarea').keypress(function(event) { if (event.which == 13) { event.preventDefault(); this.value = this.value + "\n"; } }); For what it's worth, I'm using Chrome on OS X and Enter inserts a

javascript catch paste event in textarea

烂漫一生 提交于 2019-12-05 12:36:20
I currently have a textarea which I requires control over text that has been pasted in, essentially I need to be able to take whatever the user wants to paste into a textarea and place it into a variable. I will then work out the position in which they pasted the text and the size of the string to remove it from the textarea, Then at the end deal with the text thats is in the variable in my own way. My question: how would I go about getting a copy of the text in a variable that was just pasted in by the user? Thanks. Tim Down I answered a similar question a few days ago: Detect pasted text

How to restrict max textarea width and height in chrome or how to disable textarea resizing

白昼怎懂夜的黑 提交于 2019-12-05 11:05:01
问题 Chrome allowed to resize text area by drugging that on the bottom right corner, but some times this movement may break design of the page, so i am wondering how to restrict the max and min width for that action of how to disable that function at all with thml/javascript/css on the page? 回答1: You can disable re-sizing it with the following css: resize: none; 回答2: You can also restrict to horizontal resizing only with: resize: horizontal; and only vertical resizing with: resize: vertical; 回答3:

Display current line and column number for a textarea

♀尐吖头ヾ 提交于 2019-12-05 10:30:57
I'm making a file edit interface in my web-app, I have a textarea with file contents. When textarea is focused, I want to output the position of the cursor, i.e. line number and column: this is useful because error messages usually yield a line number, for example. The question is: how do I figure out the position of the cursor in textarea? I'm using prototype library. Maybe there's a solution already? I'm not really interested in fancy toolbars for the textarea, which are offered by those advanced widgets. skrat You may want to check out these 2 links: http://www.dedestruct.com/2008/03/22

HTML/CSS/JS: How to make an illusion of a textarea with line numbers?

喜夏-厌秋 提交于 2019-12-05 10:28:48
I want to have a textarea which displays line numbers on the left. Wrap should be set to "off" (so that horizontal scrolling is available). I want to have my page as a single self-contained .html file (there will be no graphics), so I'd like to avoid any 3rd party frameworks. Which way should I go? How would you do this? I would start with two text-areas and synchronzation mechanism. Something like this, <script> window.sync = function(e){ var textarea = document.getElementById("lines"); var source = document.getElementById("some_text_area"); textarea.scrollTop = source.scrollTop; } window

Return key not working within a <textarea>

故事扮演 提交于 2019-12-05 09:51:59
I have an issue with a textarea that is defined on an asp.net page. The textarea is populated in the back end with text read directly from an mssql database. <div id="emailForm" runat="server" style="display:inline;"> <textarea name="Body" id="Body" rows="20" cols="20"> text in here <textarea> </div> The following CSS is applied to the emailForm div: padding: 5px; width: 750px; font-family: Lucida Sans, Verdana, Arial, Helvetica, sans-serif; font-size: 0.9em; margin: 0px 0px 10px 0px; border: 2px solid #ccc; and to the textarea itself: height: 360px; Some users have reported that whilst they

How bind the scroll event on a Live()?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 09:11:04
A while ago I've solve an issue for someone that wanted his textarea to grow . I've made a function that listens to the scroll and keyup events of the area and recalculates the number of rows. I wanted to use the code in another project, but there's a problem. The textarea's are not know To solve this, I'm using live instead of bind , so that future area's will be bound as well. Now I'm finding that the live executes a lot slower than a bind . I've created a simplified example on jsFiddle . The upper textarea behaves as I want, but newly added ones flicker due to the late signaling (I'm using

HTML Textarea - cursor starting in center of textarea rather than top

邮差的信 提交于 2019-12-05 09:09:53
I have an HTML template and CSS that renders a textarea field, however when clicking in the field, the cursor starts from half way down the text area, not from the top left as I would expect. This does not occur in IE, but does in Chrome and FF. I also get a list of previous values entered listed below, suggesting that the textbox styles are being applied. Can anyone advise on which CSS proprties I should be looking to modify? Here is the HTML: <input id="description" class="textarea" type="textarea" name="description" cols="70" rows="50"> Here are the properties being assigned to the text

Change textarea cursor color in the textarea

落花浮王杯 提交于 2019-12-05 08:56:55
I have the following textarea: How can I change the inner cursor color? user3040610 A custom caret can be used with either an .ani or .cur file textarea { cursor: url(cursor.cur); } or textarea { cursor: url(cursor.ani); } For more details regarding carets or .cursor { font-size: 12px; background-color: red; color: red; position: relative; opacity: 0.5; } 来源: https://stackoverflow.com/questions/20324434/change-textarea-cursor-color-in-the-textarea