Auto Height textarea
How do I make an auto height textarea?
What is a auto height textarea? How do you make a auto height textarea? This script and codes were developed by Francois Coron on 08 November 2022, Tuesday.
Auto Height textarea - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Auto Height textarea</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> ;<div class="c-container"> <form action="#" class="c-form c-form--comment"> <div class="c-form__field"> <label for="name" class="c-form__label">Name</label> <input class="c-form__input" type="text" name="name" id="name" /> </div> <div class="c-form__field"> <label for="comment" class="c-form__label">Comment</label> <textarea name="comment" id="comment" class="c-form__textarea"></textarea> </div> <div class="c-form__field"> <button class="c-form__submit" type="submit">Publish</button> </div> </form>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Auto Height textarea - Script Codes CSS Codes
*,
*::before,
*::after { box-sizing: border-box;
}
body { font-family: 'Open Sans', sans-serif;
}
.c-container { max-width: 1024px; margin: 0 auto;
}
.c-form { padding: 20px; width: 30rem; margin: 0 auto;
}
.c-form__field { margin-bottom: 10px;
}
.c-form__label { display: block; margin-bottom: 5px;
}
.c-form__input { width: 100%; height: 35px; padding: 0 10px;
}
.c-form__textarea { display: block; overflow: hidden; width: 100%; padding: 10px; font-size: 1.2rem;
}
.c-form__submit { display: block; width: 100%; padding: 10px; cursor: pointer;
}
Auto Height textarea - Script Codes JS Codes
$('#comment').on('keydown',function(){ $(this).css('height','auto'); if ( $(this).val() ) { $(this).height((this.scrollHeight) - 20); }
});
Developer | Francois Coron |
Username | francoiscoron |
Uploaded | November 08, 2022 |
Rating | 3 |
Size | 2,464 Kb |
Views | 12,144 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Simple Button Icons | 2,257 Kb |
Reveal footer | 2,856 Kb |
A Pen by Francois Coron | 3,029 Kb |
Buttons | 2,509 Kb |
STAR WARS LIGHTSABER | 4,420 Kb |
Starter jade | 2,008 Kb |
SVG CREAM | 2,766 Kb |
Light card transition on scroll | 3,814 Kb |
Responsive Nav | 3,721 Kb |
UI Quotes | 4,430 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Cake | Kennyname | 7,220 Kb |
A Pen by Paul Sullivan | Pwsm50 | 2,349 Kb |
Blank Starter | Mhartington | 2,171 Kb |
Scarlett Johansson Tribute Page | Diomed | 3,233 Kb |
Ball Physics | Getsetbro | 3,149 Kb |
Vertically rotating text with CSS | Nopr | 2,141 Kb |
Elon Musk - Tribute Page - FreeCodeCamp | Yunnimun | 8,615 Kb |
A Pen by Jim Savage | Madebyjam | 2,418 Kb |
Playing with FlexBox | _Billy_Brown | 3,162 Kb |
Animated Slide Hamburger Mobile Menu | BJack | 2,247 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!