title: How to set on change as a default on page load jquery?
body: <p>I have created a on change method for a select box of my project. On selecting particular option it is basically showing and hiding a div which is perfectly working fine. Now, my problem is when first time page is loading this show and hide not working for first default section of form. Can I make this onchange function also working when page load first time.</p>
  
  <pre><code>$('.contact-form').on('change', (e) =&gt; {
      var selectedId = $(e.currentTarget).val();
      var listofforms = $("#discount").data("display-for").split(",");
      if (listofforms.indexOf(selectedId) !== -1) {
          $("#discount").collapse('show');
      }
      else {
          $("#discount").collapse('hide');
      }
  });
  </code></pre>