-1

I am trying the jquery alert example on this webpage: http://www.tutorialscollection.com/jquery-demo/jquery-demo.php?ex=8.0_1. I'm new to using jquery and I can't figure out how to get the dependencies listed in the head section:

<head>
<script src="jquery.alerts.js" type="text/javascript"></script>
<link href="jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />

Here is the full file, but probably not needed:

<!DOCTYPE html>
<head>
<title>Examples of using jQuery Alerts</title>
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.ui.draggable.js" type="text/javascript"></script>

<script src="jquery.alerts.js" type="text/javascript"></script>
<link href="jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />

<!-- Example script -->
<script type="text/javascript">
$(document).ready( function() {
$("#basic_button").click( function() {
jAlert('Example of a basic alert box in jquery', 'jquery basic alert box');
});
});
</script>
</head>
<body>
<p>
<input id="basic_button" type="button" value="Show Basic Alert" />
</p>
</body>
</html>
thebiggestlebowski
  • 2,610
  • 1
  • 33
  • 30
  • 1
    My guess would be you're not following the documentation closely enough. (neither is the person who wrote said tutorial) – Kevin B Mar 15 '17 at 18:38
  • Almost definitely right ... when all else fails, read the instructions. Please enlighten me to where said documentation exists or how to resolve my problem ;) – thebiggestlebowski Mar 15 '17 at 18:41
  • Are you just copying and pasting? If you're doing that, you're probably having issues with the dependencies not being found because the browser is making a request for a resource that won't exist or won't be served. Look into using a CDN if that's the case – Joseph Nields Mar 15 '17 at 18:41
  • well, it appears as though this is a custom plugin called jAlerts, not the one that has documentation. http://www.tutorialscollection.com/jquery-demo/jquery.alerts.js probably not a very good tutorial to follow. – Kevin B Mar 15 '17 at 18:41
  • MIght be this: https://github.com/aurels/jquery.alerts – thebiggestlebowski Mar 15 '17 at 18:43
  • You have already helped me. I thought this was a standard plugin to be dereferenced by a standard jquery tool (like grunt, bower, etc). I may reconsider using this code since it appears not to be mainstream, ie, well tested. – thebiggestlebowski Mar 15 '17 at 18:47
  • Don't just blindly copy code from tutorials as the paths to certain files may be different. You'll have to update those according to how your project is set up. – dokgu Mar 15 '17 at 18:54

3 Answers3

1

Google hosts a CDN. To make sure JQuery's libary is loaded add this into the <head> tags

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

If you are trying this on a local machine then you can download jquery here and set it up in the <head> as this:

<script src="path_to_jquery" ></script>
James Slattery
  • 325
  • 1
  • 3
  • 12
0

I found the dependencies here:

http://www.tutorialscollection.com/jquery-demo.

thebiggestlebowski
  • 2,610
  • 1
  • 33
  • 30
0

This serves my purposes much better than the tutorial in this question: How to generate a simple popup using jQuery

thebiggestlebowski
  • 2,610
  • 1
  • 33
  • 30