Solved

Textarea height getting mysteriously set

Posted on 2015-02-12
6
55 Views
Last Modified: 2015-02-18
I have a page that has posts on it and there is a textarea for putting comments in.  The textarea height is somehow getting set by a script I'm using to automatically expand the textarea height.  For some reason the height is getting set for the text area and it is way to big vertically.  

I was hoping someone could help me figure out how to put the height of the textarea to the value i actually define in the css file.  NOTE: using !important isn't an option as this causes the textarea to not expand with the plugin.

Page with big textarea

Plugin for textareas

Thanks for any help!
0
Comment
Question by:Elxn
  • 3
  • 2
6 Comments
 
LVL 9

Expert Comment

by:sundaramkumar
ID: 40607595
post your code, that way people can help you.
0
 
LVL 2

Author Comment

by:Elxn
ID: 40608000
The code is all visible on the page.  There are several css files but what throws them off and makes the textarea too big is the plugin.  I took the plugin out and it worked just fine.  But I want to use the plugin.

You can use chrome or firefox to inspect the code, its all right there as you can see in the links i provided in my first post.

Here is the direct link to the plugin code i'm using on my site:  http://girlzunderground.com/new/code/jquery.elastic.source.js
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40608161
This is probably the function in the script where you will need to deal with the height being set by the plugin.  You might have to experiment with the curated height to get what you need:

function setHeightAndOverflow(height, overflow){
				
					var curratedHeight = Math.floor(parseInt(height,10));
					if($textarea.height() !== curratedHeight){
						$textarea.css({'height': curratedHeight + 'px','overflow':overflow});
					}
				}
	

Open in new window

                 

Cd&
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Accepted Solution

by:
Elxn earned 0 total points
ID: 40608316
I wanted to get this done so I looked at it and discovered that the script probably puts in a <div> into the page and I had in my CSS a style that affected all <div> tags inside a section.  So the height was getting set too big because the style applying to the div tag appended to the DOM was being set too big by my CSS code targeting all <div> tags.  

I changed to CSS to not apply to all <div> tags in the section and the problem was solved.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40608328
Great! Glad you got it solved. :^)

Cd&
0
 
LVL 2

Author Closing Comment

by:Elxn
ID: 40616139
I solved my own question, you can put the points to 0 as I don't think I can do this myself.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now