Set a flag for the state being toggled

Set a flag for the state being toggled

Hi,

Some one made for this code which I wrote:

  1. $('.js-showHidePassword').on('click',function(e) {
  2.        $(this).html(($(this).html() ===
  3.          '<span class="hidden_clip">click this button to show or hide the password</span><span aria-hidden="true">Hide</span>'
  4.          ? '<span class="hidden_clip">click this button to show or hide the password</span><span aria-hidden="true">Show</span>'
  5.          : '<span class="hidden_clip">click this button to show or hide the password</span><span aria-hidden="true">Hide</span>'));

The following comment:
This needs to be changed. Set a flag for the state being toggled, update it on toggle and compare against the flag. At the moment this is completely coupled to exact markup, which will change. At the very least it will vary depending on t() function return value.
 

What doe's he mean? How can I change my code to achieve his requirement?

Thanks