Show/hide image based on class of another element

I have an element that dynamically has a class applied to it based on a sorting interaction from jetboost.

When that element gets the “jetboost-sort-asc” class applied to it, I want to be able to conditionally apply visibility to a separate image element on the page.

The 2nd image element should only be visible when the class is present on the page, and hidden when its not present.

Is this something that would be possible with custom code?

Try this code

$(document).ready(function() {
  // Select the first element with the "jetboost-sort-asc" class
  var element = $('.your-class.jetboost-sort-asc');

  // Check if the element has the class
  if (element.hasClass('jetboost-sort-asc')) {
    // Show the second image element
    $('#your-image').css('visibility','visible');
  } else {
    // Hide the second image element
    $('#your-image').css('visibility','hidden');
  }
});