简体   繁体   中英

How to prevent the change of character position on selecting the content of html textarea

I've created a textarea, and counting its characters, when it reaches multiple of 160 increment the message count, and on moving the cursor it will show the character position and the message number properly. but on selecting the content it will display the message count as 0 and 0 remaining character , how to solve this, i'm trying to set the values as last character on selecting the content.

Here is the working example of what I've tried : http://jsfiddle.net/F6CZs/1/

Any guidance and help is appreciated..! Here is the actual values :

在此处输入图片说明

Here comes the change of values on selecting the content : 在此处输入图片说明

我知道这不是“ keyup”,应该只是

 $(id).bind("keydown click", function () {

Try this.

http://jsfiddle.net/U9vSF/1/

Not sure what you were trying to achieve with the, "# Message(s)" part of the counter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM