Javascript Injection - Change text field size - javascript

I have to use a special form for work and the form has a comment section that is WAY too small (about 5 lines for 30+ lines of text) Since the developers don't update the software very often, I usually take the initiative to create bookmarklets that do what I want.
I'm trying to create a javascript line that extends the size of the textbox. I am taking this approach but it does not work:
javascript:document.getElementById("CommentArea").style.height="700px";
Form name is "Survey" if that helps.
Any ideas?
(Note: I'm trying to change the visual size, not the character limit.)

Textareas use the rows attribute to determine the number of visible text lines for the control:
​document.getElementById("test").rows = 20;​
EXAMPLE

Related

Multiline placeholder that only disappears when row changes

Helo there!
I'm trying to figure out a simple way of doing multiline placeholders inside a textarea (or an alternative solution, more about that in the bottom) that only disappears when the row have changes. So, basically, if this is the initial state of the textarea (or whatever it can be)
Write a question here
Write another question here
Write the third question here
And the user clicks the first question and types A it would look like this:
A
Write another question here
Write the third question here
I've thought about three different solutions so far but not sure which one to prefer.
1) Have ghost content that is rendered separately from the area of text.
2) Instead of using a textarea, have one input per line that the textarea would be. Problem would be to implement textarea behavior but with many inputs instead. Having placeholders per line would be trivial though.
3) Have actual text and use a parser of some kind to add/remove text whenever that is needed.
Appreciate any help/pointers I can get.
I'm using React and Redux but I'm happy to get answers that are including other technologies that I can take inspiration from.

Testbox auto complete from string

I have a notepad file of about 10,000 words. I can export them as csv or tab separated values as required. Is there a way for my words to appear as suggestions in a textbox (input type text)?
This word work in the same way as google.
In HTML5 you have the datalist element which gives you a kind of autocomplete feature. Although I'm not really sure about what you want an answer to, for example it is probably not that efficient to put 10 000 words inside the datalist element.
You can use jquery along with some plugin for maximum cross-browsing capability.
Here is an example of what you are trying to achieve http://jqueryui.com/autocomplete/
Click on the vew source link on the page to see how it is done.
Edit:
Since you are using a lot of elements, why not creating an ajax request after the text change to load the elements you want and then stream them into a div right under the text box? This will make you more in control of what the user is seing and it will work on all browsers.

Create a text input that changes smileys code to picture

In my page i have a text input field and I want that when user writes code of a smileys (like :D) inside that field, input field changes that code to picture.
How can i do it?
I have came across this query earlier too. There is a chain going about the same query.
It doesnot look as easy as you are trying to potray. Writing and converting does not make sense at all.
APPROACH: You have to read each and every text entered by user if it matches the pattern of the smile and if the smiley matches then fetch the respective .gif from the images folder.
Please refer following link for a quick start.
Replace a list of emoticons with their images
This answer may be quite late, but this question still ranks high on Google...
The easiest way to add this feature ist to Use the SCEditor plugin (MIT licence). This is a JavaScript-and-CSS solution that pimps any textarea into a WYSIWYG editor. If the toolbar is disabled (see http://www.sceditor.com/documentation/options/), you result in a text input that automatically replaces emoticons with corresponding images.
Hint: It may be necessary to tell the script where to find the emoticons, using the emoticonsRoot option (took me 10 minutes to find that out - 10 of 30 minutes required from finding the SCEditor to making it work...).

Highlight edits made to a text by the user in Javascript

I'm trying to create an editable text field in a page which highlights the edits made by the user to the text as it is being edited. For instance, text inserted or changed by the user should appear against a colored background, deletions should be indicated by adding a colored background to the neighboring characters (or maybe some kind of symbol?)... It seems to be much harder than I thought to do this in Javascript, and I am surprised that I couldn't find any code already implementing such a text field.
Do you know of anything which implements what I'm looking for?
Thanks!
You should have a look at Google's Diff, Match and Patch libraries for Plain Text which are open source and available in JavaScript among other languages.
Diff demo.
Step1->
Store the original value in a variable V1
Step2->
Store the modified value in a variable V2
Step3->
For each word in V2 [word are divided by at least a single space] check it against the V1, if it's not same HIGHLIGHT it with HTML tag !

Custom HTML input component

I am trying to create a new html component using javascript and CSS.
The new component is exactly like TextField (<input type="text">).
The additional behaviour is each character in the TextField is separated in a box.
Is there any existing component available ? If not please give some ideas how to design this component.
Nothing exists in HTML for a multiple text input like you've described.
You'll need to build it yourself using multiple <input type="text"/> elements.
TextField(<input type="text"/><input type="text"/><input type="text"/>...)
Just out of interest though, why do you want this control? Typically this kind of field is horrible from a usability standpoint (even if you hook in event handlers to auto-tab you from one box to the next)
If you just want it to look like the characters are in boxes, you might be able to use a fixed-width font and a clever background graphic. Admittedly, this could pose some interesting internationalization challenges.
i would use a series of input boxes with a character limit of 1 and use CSS to make them 'square-like' to accomodate just one character

Categories