textarea

How to use dijit/Textarea validation (Dojo 1.9)?

你说的曾经没有我的故事 提交于 2019-12-02 19:03:08
问题 I have textarea which is required field. I've found post suggesting that Dojo doesn't have validation for Textarea, but in Dojo 1.9, there's an argument 'required'. I've done the following: new Textarea({required:true, value:""}, query('[name=description]')[0]) but the effect isn't what I've expected. The texarea has red border always, even if the field wasn't focused (as opposite to, for example, ValidationTextBox). But when I call: form.validate() the validation is passed even if the

jQuery plugin that suggests/autocompletes within a textarea [closed]

こ雲淡風輕ζ 提交于 2019-12-02 18:33:52
Is there a jQuery plugin that suggests/autocompletes within a textarea? What I want is to have suggested words or autocompleted text proffered to the user in a textarea like the example image below: Breezer Well there is the autocomplete plugin that does just that, and if you want to pull data from a database I recomment using the ajax API that is included in jQuery. something like this $('textarea').keyup(function(){ $.post('ajax/test.php', function(data) { $('#example').autocomplete(data); }); }); Also remember this is just the basic structure to give you an idea. P.S. I just found this it

How to highlight friends name in Facebook status update box (textarea)?

给你一囗甜甜゛ 提交于 2019-12-02 17:48:28
In Facebook status update box, when I type @ and start typing and choose a name, say Steven Gerrard, from the friends list suggested by fb, my friend's name is highlighted in the textarea like this I checked with Firebug and there's only a div.highlighter which contains sort of formated text (Steven Gerrard is within b tags) a textarea inside a div.uiTypeahead. Nothing interesting i could find and a hidden input, that contains the actual text that will be posted: @[100001915747xxx:Steven Gerrard] is awesome What is the secret trick behind this? Normal rich text editors like ckeditor usually

access textarea value

时光总嘲笑我的痴心妄想 提交于 2019-12-02 17:07:42
问题 I have a on a form of mine. I´m trying to reset the value (the value typed by the user) of this field on a certain event. However, I seem unable to access it both with .val() and .html(). Any advice on this? 回答1: Do not use .html() , use .val() . $("#your_textarea_id").val("Some literal <textarea> content."); This way special characters ( < , > etc) will show up correctly. 回答2: Set an id on that field so you can easily target it with $('#the_id') . If it's a textarea use .text(''), input use

Turn off textarea resizing

左心房为你撑大大i 提交于 2019-12-02 14:20:13
I'm trying to turn off textarea resizing in my site; right now I'm using this method: .textarea { clear:left; min-width: 267px; max-width: 267px; min-height:150px; max-height:150px; } I know that my method is not correct and I'm searching for a better one in JavaScript. I'm a beginner, so the best solution for me will be HTML5 or jQuery. Try this CSS to disable resizing The CSS to disable resizing for all textareas looks like this: textarea { resize: none; } You could instead just assign it to a single textarea by name (where the textarea HTML is ): textarea[name=foo] { resize: none; } Or by

Text area with upload attachments options HTML/JQuery

﹥>﹥吖頭↗ 提交于 2019-12-02 13:35:25
问题 I have created text area that allows user to type in their text as shown below: <!DOCTYPE html> <html> <body> <textarea rows="4" cols="50"> Please type your favourite foods here and upload attachments if you want!</textarea> </body> </html> I want to allow the user to allow be able to drag/drop or upload file attachments to the textarea but I am not quite sure how I can achieve this. I am quite new to web development and I am not sure what such feature would even be called. I have created a

HTML Form to post on php page

馋奶兔 提交于 2019-12-02 13:29:06
Thank you for reading. I'm trying to create a HTML form so that my friend can type text into it and thereafter, updates his web site with whatever is typed into the form. I'm trying to create a HTML form (on a php page) which posts whatever is entered within it's textarea to the home.php file. However, rather than simply do a "one-off" post, I'm trying to make it so that whatever is entered within the textarea saves the data into the home.php file. The home.php file is blank, and the form which I have created is as below: <form method="post" action="home.php"> <textarea id="element" name=

Automatic newline in textarea

99封情书 提交于 2019-12-02 12:09:22
问题 Using jQuery, how can I make a textarea that automatically adds a new line when inserting text when the cursor is near the end. The width of the textarea is dynamically done via CSS (e.g., #myTextArea { width: 80%; } ) so I can't do anything like counting the characters in each line. I don't need a non-JS solution since the content of the textarea is only ever seen by JavaScript anyways. 回答1: You can get the calculated pixel width of the text area and the textarea's padding. You can look up

Capitalize input text in Javascript

好久不见. 提交于 2019-12-02 11:50:09
In a form, I have two buttons to transform text to uppercase and lowercase. I am using this function to transform input text to upper case: document.xyz.textinput.value=document.xyz.textinput.value.toUpperCase() Now, I want to add a new button to capitalize each word. Is it possible to achieve this with the following code? document.xyz.textinput.value=document.xyz.textinput.value.capitalize() Thanks Try This: document.xyz.textinput.value = document.xyz.textinput.charAt(0).toUpperCase() + document.xyz.textinput.slice(1); If you want a capitalize functions, See here . CSS has some text-transform

Firefox / IE textarea sizing quirk - workarounds?

老子叫甜甜 提交于 2019-12-02 11:13:09
Try out this code in Chrome, Firefox and IE: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Textarea problem</title> <style type="text/css"> html, body { position: absolute; top: 0; left: 0; right: 0; bottom: 0; border: 0; padding: 0; margin: 0; } #container { position: absolute; top: 4px;bottom: 4px; right: 4px;left: 4px; background-color: grey; } #ta { position: absolute; bottom: 0; right: 0; top: 0; left: 0; /*width: 100%; height: 100%;*/ border: black 4px solid; padding: 0; margin: 0; background-color: orange;