textarea

jQuery Escaping HTML from a Textarea

£可爱£侵袭症+ 提交于 2019-12-05 05:40:52
I want to escape HTML tags to entity names, taking text from a textarea and putting the result in a second textarea such that: <mytag> becomes <mytag> I'm using .html() and .text() going back and forth OK. My problem is dealing with the textarea element, which acts a little different. It works fine if I first place the text into a div: var htmlStr = $('#textareaInput').val(); //doesn't like .html() .text() ? $('#dummy').text(htmlStr); // an object to hold the text that supports .html() $('#textareaOutput').val($('#dummy').html()); But I want to do something more straightforward like this: var

How to disable TinyMCE's textarea

微笑、不失礼 提交于 2019-12-05 05:35:48
I've tried all of the following: $(#"tbxNote").attr("disabled", "disabled"); ////doesn't work $(#"tbxNote").attr("disabled", "true"); //doesn't work either :) tinyMCE.init( mode: "none" ); //throws an error This is how I'm loading TinyMCE: //load tinymce plugin $('#tbxNote').tinymce({ // Location of TinyMCE script script_url: '/common/scripts/tiny_mce/tiny_mce.js', // General options theme: "advanced", // Theme options theme_advanced_buttons1: "link,unlink", theme_advanced_buttons2: "", //important theme_advanced_buttons3: "", //important theme_advanced_toolbar_location: "top", theme_advanced

Jeditable inserts extra spaces around the text in text area

放肆的年华 提交于 2019-12-05 05:13:06
Jeditable is inserting extra spaces around the actual text in a text area for me when I click to edit some text. How do I trim this or actually fix this? You can actually just pass a function to trim the string you are going to edit. Use this in your settings: data : function(string) {return $.trim(string)}, submit: "Save" Found the reason. And it is insane! In place edit will insert space around the text if you html looks like following <div id="inplace_edit_this"> This is some text that will be edited in-place. </div> And it will NOT insert space around the text if your html looks like this

Adding disable/enable methods to Summernote editor

不羁的心 提交于 2019-12-05 05:07:58
I have been using summernote editor for a while now and it's working for most of the things I've needed it for. However, I recently wanted it disabled ( not destroyed ) after a user action. After efforts without success, it occurred to me I could use the destroy() method to achieve what I wanted. I noticed that Summernote still turned an already disabled textarea to its editor, with the writing area disabled. Here is what I finally did: To disable summernote after creating it: I first destroyed it, then disabled the target element, and finally re-initialized it: $(".summernoteTarget").destroy(

How to add a keyboard listener to my onClick handler?

这一生的挚爱 提交于 2019-12-05 03:35:46
I have the following: class MyTextArea extends React.Component { handleClick = () => { this.focus(); } focus = () => this.ref.focus; handleRef = (component) => { this.ref = component; }; render() { return ( <div className="magicHelper" onClick={this.handleClick}> <textarea></textarea> </div> ); } } My CSS: .magicHelper { width: 100%; height: 100%; } textarea { line-height: 32px; } I need this because I need the textarea's placeholder are to be horizontally and vertically centered in the page. Given textareas can't vertically center text, I need to keep the height of the textarea short. I

cross browser nowrap textarea

纵然是瞬间 提交于 2019-12-05 02:57:39
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 reaches the end mattytommo All I did was remove your white-space: nowrap; and it works :). textarea{

Why does IE 8 make the cursor jump to the end of the textarea for this JS?

回眸只為那壹抹淺笑 提交于 2019-12-05 02:05:24
问题 http://jsfiddle.net/tYXTX/ In Firefox, with the above script (included inline below), you can edit the textarea's contents at any point either by clicking in the middle of the string and typing, or using the keyboard back keys (and ctrl+left arrow). In IE, the cursor always jumps to the end. Why is this, and how can I prevent it? HTML: <textarea id="bob" name="bob">Some textarea content</textarea> <div id="debug"></div> JS: $(document).ready(function(){ $("#bob").keyup(function(){ $("#bob")

XSS 2

元气小坏坏 提交于 2019-12-05 02:02:47
通过第一题之后继续进行第二题 我们会发现这个体会将内容放到<textarea></textarea>中然后我们刚才那段代码就失效了 因为这个代码可以将我们输入的内容转换成超文本 我们可以绕过过这段代码 就是通过提前闭合 例如;输入</textarea><script>alert(1)</script> 原因;通过提前闭合标签将自己需要植入的信息植入 来源: https://www.cnblogs.com/ainv-123/p/11896714.html

how to get textarea's text using jQuery with newline character preserved?

佐手、 提交于 2019-12-05 02:02:28
问题 I have a text area in which user enters text. I want to retrieve the text as user entered including the new line character which is automatically wrapped. how to get textarea's text using jQuery with newline character preserved? 回答1: Given your edit, its going to be pretty hard, if not impossible to do it accurately. The problem is that automatic wrapping doesn't actually insert any newline characters, it's just the browser rendering the one string across multiple lines... So the only way I

Retrieve text from textarea in Flask [duplicate]

筅森魡賤 提交于 2019-12-05 00:39:27
问题 This question already has answers here : Get the data received in a Flask request (16 answers) Closed 2 years ago . I would like to be able to write a multi-line text in a textarea (HTML), and retrieve this text in python for processing using Flask. Alternatively, I would like to be able to write a multi-line text in a form. I have no clue on using JS, so that won't help me. How am I to go about doing that? 回答1: Render a template with the form and textarea. Use url_for to point the form at