Categories: jQuery

Autosize: dynamic textarea sizing plugin

Share

Autosize is a small jQuery plugin that allow textarea autosize making height dynamically so that it expands as based on visitor input.

You can implement textarea autosize by calling the .autosize() method on any textarea element.

Example of textarea autosize:

$('textarea').autosize();

For implementation autosize in your website you need to follow below steps:

Include jQuery library:

<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript' src='jquery.autosize.js'></script>

Your HTML code:

<form>
<textarea id="txtID" name="txtID"></textarea>
</form>

At last, call the plugin:

<script type="text/javascript">
$(document).ready(function() {
$('textarea').autosize();
});
</script>

Read Also: 10 best jQuery Notification plugin

How it works:

When calling autosize, it adds a hidden textarea element to you document that mirrors the original textarea’s input. Mirrored textarea is used to calculate the size what the actual textarea should be. Then the mirrored textarea copies the actual textarea’s styles that relate to text formatting.

View Comments

Recent Posts

Unlock Growth – Guide to Online Financing and Business Loans for Entrepreneurs

If you are in a financial crisis , or need to start a new business…

15 hours ago

Optimize Your Hormonal Balance: Enclomiphene Citrate for Enhanced Wellness

Hormonal balance plays a pivotal role in overall well-being, influencing various aspects of health, from…

1 day ago

Paul Kanes Explores the World of Canine Companionship through Dog Walking

Dog walking is an excellent way to maintain your furry friend's camaraderie and provides many…

2 days ago

Top 5 Must-Have Features Every Mobile App Needs to Succeed

Introduction Businesses understand the diverse requirements of mobile applications, which provide a competitive advantage. There…

2 days ago

IoT Data Analytics: Ways to Gain Value from IoT Data

The Internet of Things (IoT) has recently changed the world. It links gadgets together and…

2 days ago

The Rise of NFTs: Exploring the Impact of Non-Fungible Tokens on the Digital Economy

NFTs, or Non-Fungible Tokens, are revolutionizing the digital economy. These unique digital assets, authenticated through…

3 days ago