showing results for - "javascript when button clicked different text appears"
Sebastián
15 Apr 2020
1  function show() {
2    // get the box
3    var box = document.getElementById('box');
4
5    // get the current value of the box's display property
6    var displaySetting = myClock.style.display;
7
8    // also get the box button, so we can change what it says
9    var showButton = document.getElementById('showButton');
10
11    // now toggle the box and the button text, depending on current state
12    if (displaySetting == 'block') {
13      // box is visible. hide it
14      myClock.style.display = 'none';
15      // change button text
16      clockButton.innerHTML = 'Show box';
17    }
18    else {
19      // box is hidden. show it
20      myClock.style.display = 'block';
21      // change button text
22      clockButton.innerHTML = 'Hide box';
23    }
24  }
25
queries leading to this page
jquery toggle text on clickcss change the button text valuechange text onclick csshow to output text above clicked button javascriptcss change button text on clickjs replace text in elementchange text on click with csstext swaping effect cssautomatically two texts change one by one show in htmltext hide on button and add another text in csshow to replace a text with another text when is clickedonce you click on a text in html change to show numberhow to swap text 3atextone by one text changes in htmlchange button label on click csschange text when toggledclick and reveal list html codetext swap csstext on button clickhow to change text in css when clickedchange button text on click csscss text swap effecton input box click text is swiping html csscss toggle between texts effectsclass name to check button text csschange input text on button click cssclass toggle innertextbutton click to change the text color define under 3cswap 3e taq using htmlbutton click to change the text under 3cswap 3e text in htmlhtml how to change button text smoothlychange name of bottom on click cssmy text moves when a button is clicked jsswap out text if button is active cssbutton content click with csshow to toffle between on an off clock jshow to change a seperate element with a button using javascripecss change button text after clickcan i change content html to show something else 3fjavascript when button clicked different text appearshow to display a given text when click abutton in javascriptwant button to toogle functions based on state of textjavascript when button clicked different text appears