Click Link Fill Input

Click Link Fill Input

Okay,

So I have a list of names.
First Name, Middiel Initial, Last Name, and Suffix

So I have
John Smith
Bob A. Johnson Jr.
Sally P. Thompson
etc etc etc

I have a form that has four fields, for First, Middle, Last, and Suffix.

How can I click on a name and have each section auto fill the correct field?
The names are being pulled dynamically from a database so I was thinking to wrap each part of the name with a span and class and then when you click on it so how use .val() and maybe .hasClass()

If anyone has an idea of how I could do this, please feel free to post.