Split Button Lists: Using same anchor link for multiple tasks

Split Button Lists: Using same anchor link for multiple tasks

Hello All,

I'm creating a dynamic Split button list. The lists second anchor link will be used to add and remove a particular list item to its own personalized list(displayed in another page), like a bookmark.
<a data-icon="info" href="#" id="ID_1" onClick="add_remove_fav('ID_3');"></a>
I'm facing two issues here:-

1) Issue of using same "anchor" tag of split button list to add and remove a particular list item from personalized list.


This anchor tag will be required to handle two operations:- add to personalized list and remove from personalized list.
     
      Query:- how to identify when to add or remove item on a anchor click??



I've seen links to create an incremental counter to identify even or odd and perform separate tasks on each But the idea doesn't seem to fit the requirements.

2) Another issue is to change the color of data-icon associated with the "anchor" tag of particular list item on "click" event. I've seen how to change the background color of data-icon as shown in this link:-
http://jsfiddle.net/LVnZw/27/

This link shows that the data-icon background color can be changed for a complete list

Query: However, how can i change the color of data-icon associated with the "anchor" tag of particular list item on click event ?? (depending again upon when to add or remove item on a anchor click as shared in query1).


Can anybody please provide some code and guidance to achieve these requirements.

Thanks in advance.

Ashish