R
R
rusgayfer2018-03-18 16:07:14
JavaScript
rusgayfer, 2018-03-18 16:07:14

How to make text change show/hide?

Here is the code:

<a href="#" onclick="openbox('info_zadaniya'); return false">Показать</a>
<div id="info_zadaniya" style="display: none;">
здесь текст
</div>

function openbox(id){
    display = document.getElementById(id).style.display;
    if(display=='none'){
       document.getElementById(id).style.display='block';
    } else{
       document.getElementById(id).style.display='none';
    }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Artem Vedishchev, 2018-03-18
@Artem-V

Maybe so?
https://jsfiddle.net/pm3y2cxc/6/

D
Dmitry Yuroskulov, 2018-03-18
@DmitryShade

You need to refer to your link, change its text property, just like you change the display style.
https://codepen.io/DmitryShade/pen/MVbKyz

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question