I'm using Jeditable to edit dozens of fields such as first\_name, last\_name, birthday, etc.

My problem is that I'm drowning in detail: I keep having to create a new selector such as `$('#edit_first_name').editable` or `$('#edit_birthday').editable` to making the field editable as well as create a bunch of SQL commands specific to each field to insert them once they're edited.

My question is: **Is there a way I can create something generic or OO in JQuery so that I don't don't have to endlessly create code that essentially does the same thing?**

My guess is I can create some "generic" function that will create `$('#edit_someField').editable` on the fly by feeding some JSON array, which was created by doing a SELECT on all field names I'm interested in. I imagine that's exactly what JQuery plugins do.

Any direction on how I can accomplish this would be much appreciated.

**EDIT**

One solution I have come up with is to put the table, column name and id in the id value of whatever I want to edit.
For example, if I want to edit the first\_name of id=6 on table Person, then in the id I will put `<span class="editable" id="Person:first_name:6">myFirstName</span>`. When I send the id to my `save.php` file, I use a `preg_split` to insert my data into the table.