textarea

Cross-browser method to prevent all methods of text copying from a textarea?

…衆ロ難τιáo~ 提交于 2019-12-01 17:37:22
I am working on an online typing software. In the typing software, all is going well but I have the problem of dishonest users who might possibly type the text into the textarea, copy it, then reload the page (therefore resetting the timer) and pasting it in straightaway. So I was thinking along the lines of using something like evt.preventDefault(); when javascript detects the pressing of the ctrl / cmd button along with the C key. But then I realized that the user could always go up to the menu bar to press Edit -> Copy . So I was wondering, is there a cross-browser method to disable both

Cross-browser method to prevent all methods of text copying from a textarea?

牧云@^-^@ 提交于 2019-12-01 17:36:21
问题 I am working on an online typing software. In the typing software, all is going well but I have the problem of dishonest users who might possibly type the text into the textarea, copy it, then reload the page (therefore resetting the timer) and pasting it in straightaway. So I was thinking along the lines of using something like evt.preventDefault(); when javascript detects the pressing of the ctrl / cmd button along with the C key. But then I realized that the user could always go up to the

Different maxlength validation of textarea with newlines in Chrome and Firefox

夙愿已清 提交于 2019-12-01 17:36:06
问题 The problem is that Firefox counts newline as "1" (\n) character while Chrome count them as "2" (\r\n) This is what I get in a textarea with maxlength=10 : This are 10 charcters for Firefox 1234 5 6 7 This are 10 charcters for Chrome 1234 5 6 The problem comes when trying to validate the form. If I have for example the following text 012345 678 In Firefox the validation passes and the data is saved, but when I try to do the same in Chrome it shows a warning, and prevents it from sending the

does <textarea> auto-encode inner html?

耗尽温柔 提交于 2019-12-01 17:14:21
I was trying to print some text between <textarea> and </textarea> tags, but I've noticed that if I input some characters like < and > , textarea automatically converts them to < and > . Example: <textarea><script></textarea> will produce this HTML <textarea><script></textarea> Can you explain me why this happens? Thanks in advance, any help is appreciated, best regards. It doesn't escape the contents. The HTML source remains exactly the same. It just has the capability to display the contents as is which I guess is a requirement of the <textarea> tag. The dom element should have properties

How to replace CR+LF with <br />?

和自甴很熟 提交于 2019-12-01 16:33:42
For example: A user submits a form with a <textarea name="mytext" cols="35" rows="2"></textarea> and presses ENTER within it. How would I replace the CR-LF with a <br /> ? CF has a function for this called ParagraphFormat(): <cfset form.userText = paragraphFormat(form.usertext)/> From the help docs - Replaces characters in a string: Single newline characters (CR/LF sequences) with spaces Double newline characters with HTML paragraph tags ( <p> ) It may do more than you want in that it also looks for double line breaks and adds <p> and </p> tags. Ben also has an enhanced version (a UDF) called

Changing keyboard type for html textarea on iPad

∥☆過路亽.° 提交于 2019-12-01 16:27:05
I'm writing a web application for iPad. I know it's possible to change the type of keyboard displayed when an html input field is selected using: Text: <input type="text" /> Telephone: <input type="tel" /> URL: <input type="url" /> Email: <input type="email" /> Zip Code: <input type="text" pattern="[0-9]*" /> the problem is that I have to use textarea instead of input . Is it possible to obtain the same result? If not : is there any way to change the keyboard label for the ENTER key. At the moment the default label is "Return" and I would like to have "Send" (since it's a chat app). thanks a

Changing keyboard type for html textarea on iPad

喜欢而已 提交于 2019-12-01 15:57:26
问题 I'm writing a web application for iPad. I know it's possible to change the type of keyboard displayed when an html input field is selected using: Text: <input type="text" /> Telephone: <input type="tel" /> URL: <input type="url" /> Email: <input type="email" /> Zip Code: <input type="text" pattern="[0-9]*" /> the problem is that I have to use textarea instead of input . Is it possible to obtain the same result? If not : is there any way to change the keyboard label for the ENTER key. At the

How to know what lines / chars are currently visible in a textarea?

烈酒焚心 提交于 2019-12-01 15:43:54
Online editor with "live preview": there is a textarea on the left and a preview div on the right. Whenever the textarea changes, the preview is updated. This works well for small documents; for very long documents however, it becomes sluggish, because the preview has lots of DOM elements that are constantly repainted. It would be better to only send to the preview, the part of the textarea that is currently visible (since it's the one that needs to be previewed). There is a heuristic way to get the first visible line of the textarea: determine current scroll offset of the textarea: offset =

Preventing “Enter” from submitting form, but allow it on textarea fields (jQuery) [duplicate]

折月煮酒 提交于 2019-12-01 15:30:11
This question already has an answer here: Prevent users from submitting a form by hitting Enter 30 answers $(window).keydown(function(event){ if(event.keyCode == 13) { event.preventDefault(); return false; } }); The above is the code I got which effectively kills the "enter" key as a form submitter throughout the system, which is exactly what I want. However, the enter key is also disabled on textarea tags - which the users should be able to hit enter on in order to go to the next rows. So is there a way to modify the above code to detect IF the enter is coming from within a textarea tag, it

how to implement editing/formating text area in rails

旧时模样 提交于 2019-12-01 14:49:29
i want to implement text box(text area) as shown in picture .I know the simple textarea but dont know this type of text area which gives formatting ,numbering facility,Since iam new to rails plz help me This is not something that Rails provides, but there are many javascript wysiwyg plugins that solve this problem. This has worked well for me before: https://github.com/spohlenz/tinymce-rails 来源: https://stackoverflow.com/questions/23588592/how-to-implement-editing-formating-text-area-in-rails