I have a piece of web-hosted software in which I need to expose some sort of sorting value at the start of my string to make the items appear in the correct order. The software will automatically sort the values alphabetically so I've calculated a sorting value and the outputs now sort nicely by age order like this:
- 001 Years Old David
- 033 Years Old Annabelle
- 055 Years Old Carol
- 065 Years Old Bill
I want to allow the software to sort the values using these values but then I would like the browser to only actually display the name of the person:
- David
- Annabelle
- Carol
- Bill
I am wondering if I could write a script in JQuery that listens for the text that contains " Years Old " and then strips the first 14 characters out of the display, e.g. something like
$(".DIV:contains(' Years Old ')").html(
//Here I would like to show only the text after the first 14 characters
);
If anyone has any ideas on how to achieve the above or has a better idea for how to achieve it then I would really appreciate the input!