SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to count the words of SharePoint List Item. I have used code, but it shows me only 0 words though I type several words. When I used an alert for holdtextvalue it shows me blank value. Can one tell me what is the problem?

  {  var holdtextvalue;

        alert("The value is::"+holdtextvalue);
        var count=holdtextvalue.split(/[\s\.\?]+/).length
         return false;  

share|improve this question
If txt1 is input id, you must use $("#txt1"), your current selector selects all tags with name 'txt1', which is not correct – Kai Jan 6 '12 at 8:04
The question is a little confusing. As I understand the problem is more jQuery/javascript related rather than a SPListItem field. – Anatoly Mironov Jan 6 '12 at 15:06

If your textfield looks something like this:

<input name="..." 
    type="text" value="Jordan" 

Then you can retrieve the value of this input like Kai mentioned with jQuery id selector:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.