Help to rewrite the code beautifully, I wrote clumsily, I want to know how to write it correctly.

$(".first_Ac").click(function() { $(".open1").toggle(); $(".close1").toggle(); }); $(".second_Ac").click(function() { $(".open2").toggle(); $(".close2").toggle(); $(".open1").hide(); $(".close1").show(); }); $(".free_Ac").click(function() { $(".open3").toggle(); $(".close3").toggle(); $(".open1").hide(); $(".close1").show(); }); $(".four_Ac").click(function() { $(".open4").toggle(); $(".close4").toggle(); $(".open1").hide(); $(".close1").show(); }); $(".five_Ac").click(function() { $(".open5").toggle(); $(".close5").toggle(); $(".open1").hide(); $(".close1").show(); }); 

I will be very grateful.

  • html can be seen? - C.Raf.T
  • I implemented the accordion and there is a big html code, all the classes are open pictures that change, and the elements that the accordion headings click on are lesha310392
  • not quite clear ... - C.Raf.T
  • can you change class names? and why in all handlers except one hides open1, close1? why do not hide the rest? - Grundy
  • And what's karyavogo? - darkwoolf

0