Show/Hide buttons by class loses formatting

Show/Hide buttons by class loses formatting

Hi,

I'm running into formatting issues when I toggle button visibility depending on context.  

Note, in the code below, the formatting for the button with myclass0 is unaffected, just the buttons with myclass1 and myclass2 as their visibility is toggled.  But I cannot figure out why

my code is pretty straightforward e.g.
                    <a href="#" data-role="button" class="myclass0">Button 3</a>
                    <a href="#" data-role="button" class="myclass1">Button 1</a>
                    <a href="#" data-role="button" class="myclass1">Button 2</a>
                    <a href="#" data-role="button" class="myclass2">Button 3</a>

if($('#myDiv').hasClass('contextClass1')){
      $('.myclass1').show();
      $('.myclass2').hide();
}
else{
      $('.myclass1').hide();
      $('.myclass2').show();
}

thanks

Matt