Hide/show headings and HTML elements in code

Forums Classic DFFS Hide/show headings and HTML elements in code

Viewing 1 reply thread
  • Author
    Posts
    • #21529
      Keith Hudson
      Participant

      I’d like to hide and show headings and HTML elements using javascript rather listing them in a rule. what functions are you using? Here is my attempt at functions to do so, but if you are using something different, I’d like to mimic what you do.

      function hideElement(fin){
      var fieldIdentifier = “#dffsHTML_” + fin;
      jQuery(fieldIdentifier).addClass(‘spjshidden’);
      }
      function showElement(fin){
      var fieldIdentifier = “#dffsHTML_” + fin;
      jQuery(fieldIdentifier).removeClass(‘spjshidden’);
      }
      function hideHeading(fin){
      var fieldIdentifier = “#dffsHeading_” + fin;
      jQuery(fieldIdentifier).addClass(‘spjshidden’);
      }
      function showHeading(fin){
      var fieldIdentifier = “#dffsHeading_” + fin;
      jQuery(fieldIdentifier).removeClass(‘spjshidden’);
      }

    • #21535
      Alexander Bautz
      Keymaster

      To update the object that keeps track of what’s visible and what’s hidden (when you change tabs), you should use these functions.

      Hide fields:

      spjs.dffs.hideFieldsByRule(["Field1","Field2"]);

      Unhide fields:

      spjs.dffs.unhideFieldsByRule(["Field1","Field2"]);

      Toggle headings or HTML elements by their Unique ID:

      // first parameter is the elements to make visible, second is the elements to hide
      spjs.dffs.dffsToggleHeadings("heading1,HTMLelement1","heading2,HTMLelement2");

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.