Changing a data-divider-theme dynamically.

Changing a data-divider-theme dynamically.

I am trying to change the data-divider-theme dynamically on a list.  

I am using the following code:

  1. $('#list_of_names').attr('data-divider-theme', $(this).attr("data-theme")).trigger('refresh');
With $(this).attr('data-theme') being the letter of the theme passed to it, either a,b,c or d.

The first time the user presses a button the theme changes as I want it to but then on subsequent presses the theme remains the same.

Many thanks,
Lammie.