ultimatedelman / autogrow Goto Github PK
View Code? Open in Web Editor NEWAutomatically grow and shrink textareas with the content as you type.
Automatically grow and shrink textareas with the content as you type.
I think if I add some characters (maybe 10-15 W's) to the content of the cloned box, I can trigger the box to grow or shrink before the user reaches the end of the line. A bit of a hack, but maybe not so bad.
Hi,
Seems adding a padding to textarea cause resizing having wrong height value.
You'll find a test case here : http://jsfiddle.net/Akaryatrh/wfUcM/
Moreover, focus on textarea seems required to activate autogrow. Is there a way to calculate and assign height to elements when plug-in is called ?
You've done a great job however i think its really really important to always have a destroy method available in case you need to bind and unbind such events. If you are willing to add such a feature, i am willing to submit a PR for this.
Thanks, let me know.
There should be an option that will take a function name as a paramenter and execute it whenever the textarea is resized.
I'm trying to use autogrow with a lot of other plugins together, but when I try to use a custom jquery selector, it doesn't work.
I created a html attribute on the textarea to control who already has autogrow and who's doesn't.
console.log($('.tarea_marcacao')); // return all textareas
console.log($('.tarea_marcacao[appliedAutogrow="false"]')); // return the same all textareas
$('.tarea_marcacao').autogrow({ //works
onInitialize: true,
fixMinHeight:true
});
$('.tarea_marcacao[appliedAutogrow="false"]').autogrow({ //nothing happens...
onInitialize: true,
fixMinHeight:true
});
I also tryed to use it inside a $.each loop, but it didn't worked too
$('.tarea_marcacao[appliedAutogrow="false"]').each(function(){
$(this).autogrow({ //doesn't work either....
onInitialize: true,
fixMinHeight:true
});
});
Thanks.
Is there a way to set maxheight so it can stop growing up to some point?
I have an Rails app with a remote form like this
<%= form_for Message.new, remote: true do |f| %>
<%= hidden_field_tag "room_uid", @room.uid %>
<%= f.text_area :content, class: "chat-text-field", autocomplete: "off", autofocus: true %>
<% end %>
when I submit this form, after typed a long text, the textarea does not back to its initial size. I'm calling autogrow with $('.chat-text-field').autogrow();
and submiting the form with
$( ".chat-text-field" ).keypress(function(data) {
if(data.charCode == 13 && !data.shiftKey){
$('#new_message').submit()
}
});
When i initialize a form, I may already have info in the text area.
See this jfiddle:
http://jsfiddle.net/DKfDd/
I want the 3rd text area to be fully grown. Now, you have to go in an type a letter for it to grow.
The grow property works fine, but when I delete lines the height does not re-adjust to the 'new' size. Am I doing something wrong?
In Firefox zooming out causes box to grow whenever key is pressed
Setting zoom to 100% fixes issue
We recently upgraded to jQuery 3.1.0
Now we are getting the following error when we backspace in a textbox, which is strange because we are using autogrow on textareas only.
Unable to get property 'ownerDocument' of undefined or null reference
The error happens on
clone = box.clone() //add clone class for extra css rules .addClass(opts.cloneClass) //make "invisible", remove height restriction potentially imposed by existing CSS .css({ position: 'absolute', zIndex: -10, height: '' }) //populate with content for consistent measuring .val(box.val());
Hi, i have a textarea into of a modal bootstrap, via js initialize this textarea with autogrow but this not auto resize, i think this happens because this texarea is visible only modal launch. Any solution to this.
Thanks.
I have the textarea inside of a div with a fixed height and overflow: scroll;. When the textarea approaches the height of the parent div (about one line height above). I can't find anywhere that seems like it will cause this problem, but wondering if you have any ideas.
I am looking for it to expand so that the div it is inside of needs to scroll to see the bottom of this.
I will try to recreate the issue in a fiddle.
Easy to reproduce: Use jQuery 2.x and it works fine. Switch to new jQuery 3.x release and it does not work anymore
First of all, thanks for the great plugin, I really love it!
Issue: if the autogrown textarea is initially hidden (say under a different Bootstrap tab that's not currently visible) its height is still adjusted and since it's not visible, empty textareas end up shrinking to nothing.
I believe this issue can be solved by simply not autogrowing invisible empty textareas...
onInitialize is not working on textarea. I have default more than 3 line textarea and it's not working.
Setting overflow to hidden completely disables horizontal scrolling while people might want that, for example for in browser code editing in the text area.
I paste the js file in my project.
I use the $('textarea').autogrow(), but get the following error:
Uncaught TypeError: undefined is not a functionmessage-interaction.js?compile=false:21 (anonymous function) - on the autogrow function
The textarea should resize when the form is reset or submit.
Thanks for an awsome plugin! I have three minor issues though:
I have a textarea that contains a lot of text when the page initially loads. I call ...
$('textarea').autogrow({onInitialize: true})
... and it does not grow to contain the text immediately. When I click on the textarea and type something, only then does it autogrow.
Hi, thank for your nice plugin,
I don't see the onResize method anymore.
Do you have removed it from the latest version of the plugin? why?
If I delete all the text in a textarea, the box shrinks below it's initial size. I tried setting fixMinHeight to false as well and I am not sure what else to try. Is this supposed to happen?
When I run autogrow it seems to change the focus to the textarea, causing my page to immediately scroll down.
How can I prevent that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.