Solved

Textarea height getting mysteriously set

Posted on 2015-02-12
6
59 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

756 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