JSFiddle - React, Tailwind, and code Playground

by thejsj

JavaScript

$(function(){
  // updateUi will only be available inside the scope of this anonymous function
  var updateUi = function (event) {
       event.preventdefault();
       $("span.show_hide").toggleclass("shown hidden");
       $("table").toggleclass("wide narrow");
  };  

  $("a[data-toggle-description-length]='toggle'").click(function(event){
    updateUi(event);
    $.get('/toggle_full_details');
  }); 

  $("a[data-toggle-description-length-refocus]='toggle'").click(function(event){
    updateUi(event);
    $("input[type='text']:first").focus();   // focus
    $.get('/toggle_full_details');
  }); 
});