jquery toggle text on click

$("button").click(function(){
  $(this).text($(this).text() == 'Show' ? 'Close' : 'Show');
});

4
2
Krish 100200 points

                                    $(function(){
   $(".pushme").click(function () {
      $(this).text(function(i, text){
          return text === "PUSH ME" ? "DON'T PUSH ME" : "PUSH ME";
      })
   });
})

4 (2 Votes)
0
4.4
5
Awgiedawgie 440220 points

                                      function show() {
    // get the box
    var box = document.getElementById('box');

    // get the current value of the box's display property
    var displaySetting = myClock.style.display;

    // also get the box button, so we can change what it says
    var showButton = document.getElementById('showButton');

    // now toggle the box and the button text, depending on current state
    if (displaySetting == 'block') {
      // box is visible. hide it
      myClock.style.display = 'none';
      // change button text
      clockButton.innerHTML = 'Show box';
    }
    else {
      // box is hidden. show it
      myClock.style.display = 'block';
      // change button text
      clockButton.innerHTML = 'Hide box';
    }
  }

4.4 (5 Votes)
0
4
2
Awgiedawgie 440220 points

                                        $(".email-slide").click(function(){
    $("#panel").slideToggle("slow");
    $(this)
    .text("Close")
    .toggleClass("active");
});

4 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
jquery toggle replace text jquery click toggle change text jquery toggle css text toggle tecxt jquery toggle with text inside jquery toggle html text jquery toggle content toggle button text on click jqurey jqeury toggle text change toggle button change text jquery untoggle and toggle change text jquery toogle text jquery find the text of toggle button jquery jquery toggle 2 texts toggle sentence jquery how to make toggle on click jquery show more text toggle in jquery text toggle in jquery toggle text in span jquery jquery toggle button text on click how to change button toggle text using jquery toggle with text toggle text overflow in jquery toggle text in jquery button click toggle text property in jquery how to write text on toggle jquery toggle text and i on toggle content on click jquery toggle html text with jquery code how to toggle text property in jquery toggle button jquery with changing button text how to add text inside toggle jquery text toggle toggle text on click jquery how can toggle content and text in element in jquery toggle text injquery toggle text inside a div on click of button, jquery jquery onclick toggle text how to make text toggle in and out onclick toggle button text jquery how to toggle a string of text jquery jquery on click toggle text toggle html text jquery jquery toggle text change jquery toggle text and function on click jquery toggle paragraph when clicked jquery toggle paragraph toggle in jquery change text on toggle button jquery jquery toggle change text toggletext jquery change text on toggle jquery change button text toggle jquery toggle text change jquery based on text on/off toggle button in jquery toggle button text on click jquery toggle content jquery change button text on toggle jquery toggle button text change jquery jquery toggletext change text on toggle on click in jquery toggle css jquery toggle div jquery toggle javascript text toggle button text display text and hide with toggle html toggle value jquery html toggle text button html toggle text to input field change name of bottom on click css can i change content.html to show something else? toggle text using jquery jqeyryt toggle text how to change text of a button on toggle javascript jqyert toggel text change text onclick css toggle a tag text on click toggle text with css javascript es6 toggle text in javascript es6 jquery toggle text change input text on button click css bootstrap onclick text appear toggle label js how to replace a text with another text when is clicked change text when toggled jquery toggle text button toggle content making a toggle button that shows the rest of text class name to check button text css js click to switch css change button text on click toggle show/hide txt file with button class toggle innertext change button name by toggle in jquery css text swap effect css toggle between texts effects toggle in javascript innerhtml HOW TO SWAP TEXT:TEXT how to toggle innertext on click toggle innertext js replace text in element toggle button name in jquery automatically two texts change one by one show in html one by one text changes in html text on button click speak and toggle dar in javacript button pill toggle with text inside toggle parahraph html toggle button text js css toggle text toggle content js toggle text how to change the html content of an element on toggle click button toggle jquery text on button click My text moves when a button is clicked js js innerhtnl toggle button on click button text toggle change button text on toggle on click toggle text input text toggle javasrtipt toggle text on click html text block that we can toggle jquery click toggle text how to toggle with jquery text button content click with css text toggle jquery css change button text after click how to toggle on style text JS how to toggle text in button using javascript how to change the text in button after clicking and again to previous using java script finde and toggle text in jquery plain js how toggle button with paragraph js how toggle button with paragraph tongle text jquery tongle text js toggle innertext javascript toggle tx\ext change button label on click css one button toggle text jquery change button text on click css remove toogle text how to toggle icon with text js toggle button name toggle button text onclick javascript button click to change the text color define under <swap> taq using html button click to change the text under <swap> text in html html javascript toggle button content this toggle text js on input box click text is swiping html css css toggle with text toggle with text html html toggle button change text toggle text in html toggle html text toggle text js text hide on button and add another text in css jquery toggle html text onclick function to toggle a input in js toggle button name jquery jquery buttons click and change content toogle html toggle text on click toggle page html es6 toggle text Toggle/Swap Text in javascript es6 Toggle/Swap Text in javascript how to change text in toggle jquery html toggle button text toggle html content jquery toggle html content click and reveal list html code toggle numbers using javascript html toggle between text javascript toggle text on click jquery jquery change button text onclick toggle toggle text in anchor tag in php jquery txt toggle want button to toogle functions based on state of text toggle js button connect with html toggle text with button javascript toggle text with javascript once you click on a text in html change to show number jquery toggle button text javascript on off button change in dom effect toggle change in javascript html toggle with text jquery button toggle text text toggle css toggle text on button javascript js toggle button text toggle js innertext element change text on click with css javascript toggle button text onclick change toggle button javascript html toggle button with text html toggle button with text javascript js toggle text on click *how to have a toggle text after the game js* how to toffle between on an off clock js js toggle text change text on toogle in js on toogle text change text js toggle innerhtml how to toggle text in javascript css change the button text value text swaping effect css toggle text css how to change string of button javascript with toggle how to change a seperate element with a button using javascripe how to click same button to turn on and off something in javascript innerhtml toggle change jquery swap out text if button is active css toggle text-content on route how can i toggle a button and change the text js how to change text in css when clicked toggle text jquery toggle innerhtml javascript toggle content on a button html how to change button text smoothly jquery toogle btn text jquery toggle text on click how to use toggle in jquery how to disable text select in html toggle text javascript text swap css javascript when button clicked different text appears
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source