Sorry for the too simple question, I almost don’t understand jQuery, but the work needs to be done.
Task: - If a radio button is selected - show a hidden image and text, do not hide until it switches to another radio button. - According to the hover on the text of the radio button - show only the picture.
With my code, only the second function with hover works. Those. when you hover on the radio button, the picture appears, but when you select - no.
How to fix it?
<script> $('.img2, .img3, .img4, .img5, .img6, .img7').hide(); $('#pic1').css('opacity','1'); $('.text').hide(); $(document).ready(function() { $('input[type="radio"]').click(function() { if($(this).attr('id') == 'item1') { $('#pic5, #text1').show(); } else { $('.img5, #text1').hide(); } }); $("#desc1").mouseenter(function(){ $('#pic5').show(); }); $("#desc1").mouseleave(function(){ $('#pic5').hide(); }); }); </script>