I'm trying to hide a button if it has a class "List" and if not display it. On load itself I'm displaying the button, and later if that has a class, I'm hiding it using jquery. It works too!. But I'm not sure that it is the best way to do it. Any suggestions? Here is my code

```
$('.ProductList').parent().find('.CompareButton').show();
   if($('ul.ProductList').hasClass('List')) {
           $(this).find('.CompareButton').hide();
   } 

```