Demo only works on Jsfiddle

Asked

Viewed 31 times

0

My problem can be a very simple thing, is that I’m new to script programming and I’m getting a lot of hits! I cannot make this demo work in my.html file:

Jsfidde demo link: https://jsfiddle.net/h5q7pe3m/33/

I put the following in my . html:

<div id="allow-or-not" title="Show Again?">
  <p>Would you like to show this dialog again?</p>
  <button name="yes" class="ok allowed">Yes</button>
  <button name="no" id="exit">No</button>
</div>

<script src="jquery.min.js"></script>
<script>
if (!localStorage.hideAlert) {
  $(function() {
    $("#allow-or-not").dialog();
  });
} else {
  $("#allow-or-not").css("display", "none");
}
$(".ok.allowed").on("click", function() {
  $("#allow-or-not").dialog("close");
});
$("#exit").on("click", function() {
  localStorage.setItem('hideAlert', true);
  $("#allow-or-not").dialog("close");
});
</script>

There’s something that’s missing?

  • 2

    The references to the jquery in the head of your page? If you look at fiddle’s Resources, you will see that it has the pro links jquery and jqueryui

  • Thanks @Ricardopunctual, I had not even realized I had that part of Resources there rss, now I was aware! (want to add your comment as reply I can mark as certain)

  • I added as a response, even if someone already needs direct links.

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.