jQuery检测何时我们在textarea中的文本结尾 [英] jquery detecting when we are at the end of text in textarea

查看:58
本文介绍了jQuery检测何时我们在textarea中的文本结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想学习jquery,我想知道如何确定给定文本区域中一堆文本的用户何时是文本区域末尾的用户并尝试单击.例如,文本的最后一行是asdf,并且当用户在该行上并按下箭头键时,我希望得到某种事件,或者至少能够弄清楚我们是否在最后一行,然后执行一个操作(例如,环绕并转到第一行)

I am just trying to learn jquery, and I was wondering how can you figure out when, given a bunch of text in a textarea, is the user at the end of textarea and tries to click down. For example, the last line of the text is asdf, and when the user is at that line, and presses down on the arrow key, i would like to get an event of some sort, or at least be able to figure out whether we are at the last line, and do an action (for example, wrap around and go to the first line)

如果有人对如何做到这一点有所了解,将不胜感激!

If anyone has some idea of how to do this, it would be greatly appreciated!

Jason

推荐答案

签出 http://jacklmoore.com/autosize/

它很简单:

// Example:
$(document).ready(function(){
    $('textarea').autosize();    
});

这篇关于jQuery检测何时我们在textarea中的文本结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆