text change

by lakshmipriya001

HTML

<button class="show-btn rd-Show " data-toggle="offcanvas" data-alt-text="Collapse <i class='fa fa-arrow-up eng-arrow'></i>" >Expand<i class="fa fa-arrow-down eng-arrow" aria-hidden="true"></i></button>

JavaScript

jQuery.fn.toggleText = function() {
      var altText = this.data("alt-text");

      if (altText) {
        this.data("alt-text", this.html());
        this.html(altText);
      }
    };

    $('[data-toggle="offcanvas"]').click(function ()  {

      $(this).toggleText();
    });