title: Use Javascript if function to display a SweetAlert popup
body: <p>I would like to display a <a href="https://sweetalert.js.org/guides/#advanced-examples" rel="nofollow noreferrer">SweetAlert</a> popup if uploads are currently switched off, this is set by the <code>li</code> element having a class of "upload-off"</p>
  
  <p>How can I incorporate an if Javascript condition to display the popup and just do nothing if the "upload-on" class if present of the <code>&lt;li&gt;</code></p>
  
  <p>I plan to use Vue on the page at a later date, so preferably need to use Javascript rather than jQuery (as I here of potential conflicts with Vue and jQuery)</p>
  
  <pre><code>&lt;!-- There are two classes which toggle, upload-off and upload-on--&gt;
  &lt;li class="uploadli upload-off"&gt;
      &lt;p&gt;Upload Off&lt;/p&gt;
  &lt;/li&gt;
  
  &lt;input value="" id="myuploadbutton" type="file" name="Uploader" placeholder="Upload here"&gt;
  
  &lt;!-- Sweetalert Popup - Only display popup if uploads are currently disabled
  
  
  
  function upload_check() {
  swal({
      text: "Uploads are currently disabled, please apply here at http://www.example.com/apply",
      icon: "error",
      buttons: ['Apply Now'],
      dangerMode: true
      })
      .then(function(value) {
      console.log('returned value:', value);
      });
  }
  
  --&gt;
  </code></pre>
  
  <p>OVERVIEW: User click on upload button, if the class "upload-off" is present on the <code>&lt;li&gt;</code> element we get a SweetAlert popup</p>
  
  <p>Here is a similar SweetAlert issue</p>
  
  <p><a href="https://stackoverflow.com/questions/51579801/how-to-show-sweetalert-in-javascript">How to show SweetAlert in JavaScript</a></p>