English 中文(简体)
jquery text area length est?
原标题:jquery text area length count?


I have a text area field where i need to provide information about the word count when the user enters some text in the field. Length of the field is supposed to be 500 Characters. Initialy it must show

敏锐特性:100 ±0,500 /0, 必须是红色。

用户一旦进入,也需要更新计算。 用户一旦达到计算标准,就需显示100的特性。

min natures:100 ±100 ,500 /100 , 必须是绿色的。

How can i do this?? is there any plugin for the same??? let me know your thoughts on this.

最佳回答

Try to use this plugin feature

jquery-character-counter from jqeasy.com

问题回答

简单计算方法:

var count = $("#your_textarea").val().length;

i 用途

j 抗生素

http://roy-jin.appspot.com/jsp/textareaCounter.jsp” rel=“nofollow”http://roy-jin.appspot.com/jsp/textareaCounter.jsp

我对冲淡事件感到困惑,在key上取得了成功。 这里,我提出的法典是缩小其余特征(限制120)。

$(function() {
  var input = $( #my-input ), display = $( .char-count ), count = 0, limit = 120;

  count = input.val().length
  remaining = limit - count
  update(remaining);

  input.keyup(function(e) {
    count = $(this).val().length;
    remaining = limit - count;

    update(remaining);
  });

  function update(count) {
    var txt = ( Math.abs(count) === 1 ) ? count +   Character Remaining  :  count +   Characters Remaining 
    display.html(txt);
  }

});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签