View Full Version : Trying to truncate a string in JQuery

Nov 20th, 2008, 05:50 PM

I have the following code:

<div class="person">John S</div>

Is is possible in JQuery to remove the last letter of the text within the div class "person"?

I'm banging my head off a brick wall trying to figure this out, any help would be greatly appreciated.

Thanks in advance

Nov 21st, 2008, 08:22 AM
var cls='person'; // Name of the class you are referring

Nov 21st, 2008, 11:16 AM
Something strange is happening, I have 3 <div>'s with this class on it and after applying the code each div now contains the 3 people's names with only the last name with the surname removed. Any ideas on where I might be going wrong?