textarea

Replacing text inside textarea without focus

主宰稳场 提交于 2019-12-01 05:19:21
I want to replace selected text(or insert new text after cursor position if nothing is selected). The new text is entered from another textbox. I want to be able to insert new text without clicking first (focusing) in the textarea. meaning: first select text to replace inside textarea, then enter new text into the textbox and click the button. <textarea id='text' cols="40" rows="20"> </textarea> <div id="opt"> <input id="input" type="text" size="35"> <input type="button" onclick='pasteIntoInput(document.getElementById("input").value)' value="button"/> </div> function pasteIntoInput(text) { el

How to get value of CKEditor 5?

我与影子孤独终老i 提交于 2019-12-01 05:19:00
I want to be able to return the value of the CKEditor textarea, and also write my text inside it. I used CKEditor 5 CDN. First this my code for the textarea it works fine <script src="https://cdn.ckeditor.com/ckeditor5/1.0.0-alpha.1/classic/ckeditor.js"></script> <textarea class="inputStyle" id="editor" name="content" placeholder="Write your email.."></textarea> <script>ClassicEditor.create(document.querySelector('#editor')).catch( error => { console.error( error ); } ); </script> I used to get the data from the textarea before the CKEditor by: var text = $('textarea#editor').val(); and set

execute javascript from textarea

孤街浪徒 提交于 2019-12-01 04:13:39
I'm not entirely sure if this is possible, but I'm trying to create a mini faux editor in a browser that runs javascript on the page. Here's what I've been trying to do in theory HTML ​<textarea id="cnsl"></textarea> <button onclick="run()"> run </button> javascript var cnsl = document.getElementById('cnsl'); function run() { return cnsl.value } more specifically I'm trying to write to a canvas element via the 'code' I type into the text area, so that if, for example, i type ctx.fillRect(10,10,10,10); into my textarea and then execute that run() function the 10x10 square will appear in my

Html.TextAreaFor in asp.net mvc

岁酱吖の 提交于 2019-12-01 02:36:51
I have a asp.net mvc view that allows the user to enter some description in a textarea. There are two problems that I am facing. Either when I expand the textarea it is expanding without moving other html elements or I am not able to make create a Html.TextBoxFor () multiline textbox. Can anyone suggest a solution to this? If Use Textarea how to make it expand(grow in size) so that it does not overlap with other elements or how to use Html.TextBoxFor() for multiline? This is how my code looks like <% using (Html.BeginForm()) { %> <%: Html.ValidationSummary(true)%> <fieldset> <div class="editor

Disabling Textarea from CSS

随声附和 提交于 2019-12-01 02:15:30
In order to disable a textarea (or any other input element), you can: In HTML, you can write: <textarea id='mytextarea' disabled></textarea> From jQuery, you can: $("#mytextarea").attr("disabled","disabled"); CSS? Is it possible to disable the textarea with CSS? You can make a textarea appear disabled, but you can't actually disable it. Using JavaScript, all you're really doing is modifying the same DOM attribute that's set by the HTML disabled attribute, so using HTML and JavaScript you're essentially doing the same thing. CSS, however, is completely out of this picture, as it doesn't do DOM

execute javascript from textarea

别说谁变了你拦得住时间么 提交于 2019-12-01 02:00:51
问题 I'm not entirely sure if this is possible, but I'm trying to create a mini faux editor in a browser that runs javascript on the page. Here's what I've been trying to do in theory HTML ​<textarea id="cnsl"></textarea> <button onclick="run()"> run </button> javascript var cnsl = document.getElementById('cnsl'); function run() { return cnsl.value } more specifically I'm trying to write to a canvas element via the 'code' I type into the text area, so that if, for example, i type ctx.fillRect(10

How to get value of CKEditor 5?

末鹿安然 提交于 2019-12-01 01:59:15
问题 I want to be able to return the value of the CKEditor textarea, and also write my text inside it. I used CKEditor 5 CDN. First this my code for the textarea it works fine <script src="https://cdn.ckeditor.com/ckeditor5/1.0.0-alpha.1/classic/ckeditor.js"></script> <textarea class="inputStyle" id="editor" name="content" placeholder="Write your email.."></textarea> <script>ClassicEditor.create(document.querySelector('#editor')).catch( error => { console.error( error ); } ); </script> I used to

Detect url in textarea with JS or Jquery

我只是一个虾纸丫 提交于 2019-12-01 01:32:46
How to detect (in a textarea or others inputs) if the user has finished to enter a url as Facebook does in its main form please ? Solutions like this work but only when the user has finished typing and performs an action, eg clicking a button. I will wish to detect urls throughout the entry, eg run a check on the word that has been typed after each space. Thank you in advance. Here is an example on how you could do this: $(function() { "use strict"; var url = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi; $("#textarea").on("keyup", function( e ) { var urls

R Shiny store the user input from multiple dynamically generated textAreaInput fields in an object in the server part

妖精的绣舞 提交于 2019-12-01 01:23:53
New to shiny and struggling with this for more than two days now. I have created an application where the user loads .csv data file and chooses one or more variables whose names appear in the application as check boxes. When a checkbox is checked, a new checkbox appears under with the same name and when it is clicked too, a textAreaInput appears next to it where the user can add variable names that constitute the target variable as a scale. Here is an oversimplified version of the application: library(shiny) ui <- fluidPage( mainPanel( fileInput(inputId = "file", label = "Choose File",

PHP - HTML Form TEXTAREA containing HTML

冷暖自知 提交于 2019-12-01 00:57:54
I'm using a HTML form's TEXTAREA field that will contain text and it may can contain itself some HTML tags. I have read here that this should be managed using htmlspecialchars function, however this will show the HTML tags in a way it will be quite difficult to allow easy editing of the HTML code into the form TEXTAREA. What is the safer, easier way to achieve this, ensuring that quotes and "dirty" HTML code will not spoil the form? The usual workflow: Provide a Javascript rich-text editor for your users such as TinyMCE: http://tinymce.moxiecode.com/ Grab the source generated by the RTE and