function dawn(input) { input.value = input.value != 'close' ? 'close' : 'open' } $(function(){ $("#closeinput").click(function () { $("#closediv").slideToggle("slow"); }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id='closediv'> <b>Правило.</b> Ё должна использоваться: в случаях возможных разночтений; в словарях; в книгах для изучающих русский язык (т. е. детей и иностранцев); для правильного прочтения редких топонимов, названий или фамилий. Во всех остальных случаях наличие буквы ё только затрудняет чтение. Она плохо выглядит, зато хорошо звучит. </div> <input type="button" id='closeinput' value="close" onclick="dawn(this)"> 

I need instead of the open / close button there was a picture that is izmenyaetsya Ie for example down arrow instead of open button (open.png) and up arrow instead of close (close.png)
IMPORTANT! Initially, the block must be OPEN!

    1 answer 1

     function dawn(input) { } $(function() { $("#closeinput").click(function() { if ($(this).hasClass("open")) { $(this).removeClass("open"); $("#closeimg").attr("src", "https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_up_48px-512.png"); } else { $(this).addClass("open"); $("#closeimg").attr("src", "https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_down_48px-128.png"); } $("#closediv").slideToggle("slow"); }); }); 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id='closediv'> <b>Правило.</b> Ё должна использоваться: в случаях возможных разночтений; в словарях; в книгах для изучающих русский язык (т. е. детей и иностранцев); для правильного прочтения редких топонимов, названий или фамилий. Во всех остальных случаях наличие буквы ё только затрудняет чтение. Она плохо выглядит, зато хорошо звучит. </div> <button id='closeinput' onclick="dawn(this)" class="open"> <img id='closeimg' src="https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_down_48px-128.png" style="width:30px"> </button>