textarea

How to properly style a text area with inner shadows and scrollbar

孤人 提交于 2020-01-11 15:47:10
问题 I'm putting an inner-shadow on all my controls, inputs and textareas by using the following CSS: input { padding: 7px; -webkit-box-shadow: inset 2px 2px 2px 0px #dddddd; -moz-box-shadow: inset 2px 2px 2px 0px #dddddd; box-shadow: inset 2px 2px 2px 0px #dddddd; } and, with some other styling, looks like this (in Firefox, and similar in other browsers): But the padding that helps separate the content from the inner shadow breaks the textarea around the scrollbar: and if I remove the padding,

selectionStart and selectionEnd in contenteditable element

孤街醉人 提交于 2020-01-10 17:26:49
问题 I have been struggling the selectionStart and selectionEnd attributes of textarea to make them work with contenteditable div element. I have checked a lot of related articles on google and on SO but to no avail. I have something similar to the following which is working for textarea perfectly. But I want this one to work with contenteditable div. function replaceVal(node, val, step){ //... var cursorLoc = node.selectionStart; node.value = node.value.substring(0, node.selectionStart - step) +

selectionStart and selectionEnd in contenteditable element

雨燕双飞 提交于 2020-01-10 17:25:09
问题 I have been struggling the selectionStart and selectionEnd attributes of textarea to make them work with contenteditable div element. I have checked a lot of related articles on google and on SO but to no avail. I have something similar to the following which is working for textarea perfectly. But I want this one to work with contenteditable div. function replaceVal(node, val, step){ //... var cursorLoc = node.selectionStart; node.value = node.value.substring(0, node.selectionStart - step) +

IE z-index trouble on element with transparent background

橙三吉。 提交于 2020-01-10 03:55:10
问题 everyone. I need 2 absolutely positioned textarea elements to be placed one over the other. Here is my sample: <div> <textarea id="txt1" style="position:absolute; top:0; left:0;z-index:0;background:none;">some text</textarea> <textarea id="txt2" style="position:absolute; top:0; left:0;z-index:1;background:none;"></textarea> </div> I'm expecting txt1 to be under the txt2. That happens in FF and Chrome. But in IE (tested in 8 and 9) txt1 is clickable and becomes focus. Does anybody know, how to

Is there anyway to have a textarea “autofit” height based on the content at page load?

纵然是瞬间 提交于 2020-01-10 02:21:46
问题 Is there anyway through CSS or Javascript set the height of the textarea based on the content? I have a hardcoded height in my CSS but i wanted it to default so there is no vertical scroll bar on page load? 回答1: How about http://www.jacklmoore.com/autosize/ Drop Autosize into any web page and it should Just Work. The source is short and well commented if you are curious to how it works. // Example: $(document).ready(function(){ $('textarea').autosize(); }); Source: https://github.com

How to do scrollbar outside textarea?

一世执手 提交于 2020-01-06 19:26:18
问题 Can anybody have to do scrollbar outside <textarea> ? I found something like this http://jsfiddle.net/jlmyers42/8tptqt19/ but it doesnt work for teaxtarea. The best will be using only css and html. Thanks in advance :) 回答1: If you mean, have a scroll bar outside of that particular element you could encapsulate it within a div like so. <div style="overflow-y: scroll; overflow-x: hidden; height: 100px"> <textarea style="overflow-y:auto;" placeholder="Enter Notes here (optional)"></textarea> <

How to verify presence of scrollbar in textarea using selenium.

一个人想着一个人 提交于 2020-01-06 18:06:35
问题 I have a text area in web page which has no scrollbar initially. But when i exceeds the character by 1000, scrollbar is displayed in the textarea. I have to verify the same whether scrollbar is present or not in the textarea when i click or edit the same textarea. 回答1: The client width or height will decrease if a scrollbar is added. So one way would be to check the size before and after. Here's an example (Java) : Long height_before = Long.parseLong(element.getAttribute("clientHeight"));

How to verify presence of scrollbar in textarea using selenium.

前提是你 提交于 2020-01-06 18:05:10
问题 I have a text area in web page which has no scrollbar initially. But when i exceeds the character by 1000, scrollbar is displayed in the textarea. I have to verify the same whether scrollbar is present or not in the textarea when i click or edit the same textarea. 回答1: The client width or height will decrease if a scrollbar is added. So one way would be to check the size before and after. Here's an example (Java) : Long height_before = Long.parseLong(element.getAttribute("clientHeight"));

Rails: Using a Textarea for :has_many relationship

ぃ、小莉子 提交于 2020-01-06 12:53:11
问题 Hey guys, first question here. I have a couple of Products and Users that can put those Products on Wishlists. A User can have many Wishlists (for different purposes). Products can be added to Wishlists, but there's additional information involved: you have to specify an amount of a certain Product. This logic is used in the Inclusion, which has a field quantity . Class Wishlist belongs_to :user # User class is irrelevant here has_many :inclusions has_many :products, :through => :inclusions

Replace n-th tab character with a string using Javascript/jQuery

久未见 提交于 2020-01-06 03:59:27
问题 I have a line of items in Excel, and when I copy them in a textarea, I have several tab characters. I use this on purpose. Is there a way to replace n-th tab characters with a new line (each) and insert a specific word for each tab? Here is what I have so far http://jsfiddle.net/kjuxk7m9/ <textarea rows="10" cols="50" onblur="this.value=this.value.replace(/\t/g, '\n')"> Basically, when I enter the following in a textarea: Item1 Item2 Item3 Item4 Item5 (between items are tab characters), my