textarea

how to enter a random value in a textarea without an id?

 ̄綄美尐妖づ 提交于 2019-12-02 05:33:16
I have to enter a random value in a textarea of a web site by using grease monkey script the text area didn't have an id so document.getElementById doesn't work. Can I use another method to do that? My current HTML showing my textarea : <tr> <td class="tdv pd5"><span class="tbg"> Message</span> </span> </td> <td class="pd5"> <textarea name="inpx_msg" class="msgbox"></textarea> <br /> <div class="tsm">140 characters max.</div> </td> </tr> You could use element.querySelector if you want to be able to specifically target an element using a CSS selector, similar to this: var textArea = document

Why getting a text selection from textarea works when a button clicked but not when a “div” clicked (in Internet Explorer)

梦想与她 提交于 2019-12-02 04:21:23
Consider the following code: ( Live demo here - Open in Internet Explorer 7 or 9 ) HTML: <textarea>Hello Stack Overflow</textarea> <input class="a" type="button" value="Click here does the job" /> <div class="a">But clicking here not :(</div> JS: function getInputSelection(el) { var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange; if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { start = el.selectionStart; end = el.selectionEnd; } else { range = document.selection.createRange(); if (range && range.parentElement() == el) { len = el.value

Automatic newline in textarea

孤者浪人 提交于 2019-12-02 03:53:11
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. S.. You can get the calculated pixel width of the text area and the textarea's padding. You can look up the average (or mode, or whatever pleases you) horizontal width of your font. You can make a guess at the

Convert html tag in textarea to rich text

懵懂的女人 提交于 2019-12-02 03:20:50
问题 I am using PHP to fill a textarea: <textarea text-input" id="Desc" rows="15" wrap="soft" name="Desc"><?php echo $Desc; ?></textarea> but the textarea is showing HTML tags in it, which I don't want. <b>Analog And Digital System</b><br /> <b>Analog System:</b><br /> A string tied to a doorknob would be an analog system. They have a value that changes steadily over time and can have any one of an infinite set of values in a range. If you put a measuring stick or ruler at a specific point along

textarea中文本高亮选中

孤街醉人 提交于 2019-12-02 02:32:46
  最近在实现原文/译文句段高亮对比显示,和有道翻译类似,如下图所示:   最初的解决方案是采用富文本编辑器,把所有句段信息都用HTML标签包裹,操作空间比较大,页面上需要的功能几乎都可以实现,但是由此带来了许多的弊端,比如:      1.复制文本存在原始格式     2.复制大量文本页面存在性能问题(富文本编辑器的通病,复制几十万文字的文本可能导致页面崩溃)     3.截取文本操作难度较大...   目前看业界主流的翻译软件,都是采用 textarea + 富文本 组合,这种解决方案可以极大的避免复制文本格式与页面性能问题,虽然页面操作空间没有富文本编辑器大,但是大多数场景是可以满足要求的。   废话少说,textarea文本的高亮主要借助于selectionStart/selectionEnd两个属性,配合文本的focus即可实现文本的选中效果,MDN有详细的解释,如下:          实现代码如下:      <template> <section> <textarea ref="textarea" name="test" id="" cols="30" rows="10" v-model="txt"></textarea> </section> </template> <script> export default { name: 'i-select', data

Coloring lines inside textarea

那年仲夏 提交于 2019-12-02 01:22:38
Is there any way to make textarea display lines in colors? What I am trying to achieve is every second line colored, i.e. white,grey,white,grey,white,grey... for better readability. Users are supposed to write in lots of stuff, as in "enter names, each one from new line". I do use jQuery anyway so if they made some simpler solution for this it would be perfect. What you are looking for is called Zebra striping, maybe that will help with some google searching. However, I don't think there is a way to currently do this to text within a textarea (besides using the background image hack). CSS3 has

Convert html tag in textarea to rich text

怎甘沉沦 提交于 2019-12-02 01:18:12
I am using PHP to fill a textarea: <textarea text-input" id="Desc" rows="15" wrap="soft" name="Desc"><?php echo $Desc; ?></textarea> but the textarea is showing HTML tags in it, which I don't want. <b>Analog And Digital System</b><br /> <b>Analog System:</b><br /> A string tied to a doorknob would be an analog system. They have a value that changes steadily over time and can have any one of an infinite set of values in a range. If you put a measuring stick or ruler at a specific point along the string, you can measure the string's value every so many seconds at that point. When you watch it

How to color specific character(s) in textarea

只愿长相守 提交于 2019-12-02 01:15:45
I am making a program to search for characters in the desired <textarea> . I need to color the specific character that i found in text area. How can I color the character(s) in the <textarea> ? For example, if i enter 'a' in input field than all the 'a's in the <textarea> should colored red..... HTML <form method="post" name="searching" onSubmit="return check(this)"> <table border="0" cellpadding="10px" align="center"> <tr><td width="114"> <label><b>Text</b></label></td> <td width="287"> <textarea name="para" cols="30" rows="10"></textarea> </td> </tr> <tr> <td> <label><b>Alphabet</b></label>

Firefox textarea sizing bug?

孤街浪徒 提交于 2019-12-02 00:05:36
问题 I'm attempting to create a fixed textarea that fills the entire width and height of the browser window using just CSS, and the following works perfectly in Chrome: textarea { border: 2px solid #3D6AA2; padding: 5px; position: fixed; top:0; left:0; right:0; bottom:0; resize: none; } http://jsfiddle.net/BulletzBill/FZr9k/1/ However, if you view the fiddle in Firefox, it appears as though it does not take the bottom or right rules into account at all. Is this a known bug in firefox, or is there

Firefox textarea sizing bug?

强颜欢笑 提交于 2019-12-01 23:05:55
I'm attempting to create a fixed textarea that fills the entire width and height of the browser window using just CSS, and the following works perfectly in Chrome: textarea { border: 2px solid #3D6AA2; padding: 5px; position: fixed; top:0; left:0; right:0; bottom:0; resize: none; } http://jsfiddle.net/BulletzBill/FZr9k/1/ However, if you view the fiddle in Firefox, it appears as though it does not take the bottom or right rules into account at all. Is this a known bug in firefox, or is there any workaround for it? I'd like to avoid using javascript/window resize listeners if possible. Here is