There are 4 pictures in each of the 4 div, how to show / hide the picture according to the different state status, so that each div only shows the corresponding picture of the state?

 var stat=data[item].status;
 var imgCls = "c"+stat;
 $("-sharpimageState").attr("class", imgCls);
 //var imgCls=$("-sharpimageState").attr("class")
 if(imgCls==="c0"){
    $(".worked").show();
 }else if(imgCls==="c1"){
    $(".hired").show();
  }else if(imgCls==="c2"){
    $(".commu").show();
  }else{
      $(".out").show();
  }

Why doesn"t this work?

Apr.02,2021

Js wrote something superfluous! If you take a closer look at the styles you define and combine with your html structure, when the class of the container imageState is set to c0 or C1 or c2 or c3, the corresponding image will naturally be displayed (determined by css), and the rest will be hidden by default.
does not need superfluous if at all. $('.xxx'). Show (); the only thing you may need js to do is to specify what the class of a good imageState is.

  

hide the pictures first, and then add a class, to the corresponding pictures according to state to control the display

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaadca-46d50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaadca-46d50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?