Solved

Textarea height getting mysteriously set

Posted on 2015-02-12
6
60 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
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

738 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