I am working on an HTML list full of names, and each name is written in this format:
"firstname-lastname/" (example: john-smith/)
So I was curious to know if I could use JavaScript to change the format of the text into:
"Firstname Lastname" (example: John Smith)
As I am relatively new to JavaScript, and I haven't done much work with it the language yet, and I wasn't able to do this.
Here is a snippet of the HTML list:
<ul>
<li><a href="john-smith/"> john-smith/</a></li>
<li><a href="joe-smith/"> joe-smith/</a></li>
<li><a href="gina-smith/"> gina-smith/</a></li>
<li><a href="tom-smith/"> tom-smith/</a></li>
<li><a href="peter-smith/"> peter-smith/</a></li>
</ul>
Also, if I wasn't clear enough, I do not want to change the href, just the actual text that is displayed.