Title: Method
Last modified: August 21, 2016

---

# Method

 *  [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/)
 * If I were to obtain the position of the last character of a paragraph, would 
   the .indexof() method be the best to use ?
    Any suggestions?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [VeeBeeGlobal](https://wordpress.org/support/users/veebeeglobal/)
 * (@veebeeglobal)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699576)
 * So you want the string position of the last character in a paragraph??
 * You could use some javascript I would think to break up the paragraphs.
 * V
 *  [billynair](https://wordpress.org/support/users/billynair/)
 * (@billynair)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699578)
 * depends what you are trying to do, you might want to look at
 * `var n = str.length;`
 * to get the length of the string then something like
 * `var x = str.charAt(n);`
 * indexof() is used when you know what you are looking for but not sure where it
   is in the string
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699640)
 * cool thanks! Ill try it out. it’s only one paragraph that Im dealing with
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699647)
 * okay , so Ive named my <p> tag “abouttext”.
 * >  $(“a.about”).click(
   >  function () { var x = $(“#abouttext”).length; var pos
   > = $(“#abouttext”).charAt(x); alert(pos); } );
 * whats wrong with my try here? Im just using the alert for testing purposes.
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699657)
 * ok so I tried this, for sake of learning:
 * $(“a.about”).click(
    function () { var blaze = $(“#abouttext”); var x = blaze.
   length; alert(x); } );
 * the result in the window is 1. Which is weird, because the <p> has at least a
   couple hundred characters. the text in the <p> tag is all 0’s and 1’s. Does that
   have anything to do with it?
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699659)
 * $(“a.about”).click(
    function () { var blaze = $(“#abouttext”); var x = blaze.
   text().length; alert(x); } );
 * The result of this was 833. cool.
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699661)
 * Can anyone tell me why this wont work ?
 * $(“a.about”).click(
    function () { var blaze = $(“#abouttext”); var x = blaze.
   text().length; var pos = blaze.charAt(x); alert(pos); } );
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699668)
 * ok here’s the problem in its real context.
    Trying to animate some text. Basically
   the idea is to remove the last character, fill in it’s position with it’s neighboring
   character (to its left, of course), and then remove it again. Repeat this until
   the rest of the text is gone.
 * Below is my attempt.. that doesn’t work. Note that I declared my variables and
   functions before the click event, which starts the animation. My guess is I probably
   don’t have proper syntax either.
 * >  var x = $(“#abouttext”);
   >  var pos = x.charAt(833);
   > function Continue () {
   >  var y = pos.prev(); pos.append(y); pos.fadeOut(“fast”,
   > linear, function Continue()); };
   > $(“a.about”).click(
   >  function () { pos.fadeOut(“fast”, linear, Continue());});
 * help!
 *  Thread Starter [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * (@nollieheel)
 * [12 years ago](https://wordpress.org/support/topic/method/#post-4699689)
 * still trying, but here’s my last attempt for the day. Think I’m getting a bit
   closer:
 * >  var x = $(“#abouttext”);
   >  var odg = x.text().charAt(832);
   > function animContinue () {
   >  var y = x.text().charAt(832); y.fadeOut(“slow”,
   > animContinue()); }
   > $(“a.about”).click(
   >  function () { odg.fadeOut(“slow”, animContinue() ); } );
 * I’m basically trying to remove the characters one-by-one, but in a fixed location
   on the screen.. Almost as if the last character were a vacuum for all the preceding
   characters.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Method’ is closed to new replies.

## Tags

 * [method](https://wordpress.org/support/topic-tag/method/)
 * [p tag](https://wordpress.org/support/topic-tag/p-tag/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [NollieHeel](https://wordpress.org/support/users/nollieheel/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/method/#post-4699689)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
