Search code examples
javascriptjquerytwitter-bootstrapbootstrap-growl

Alert Not Being Triggered in Bootstrap Growl


I am attempting to utilize bootstrap growl to create an alert popup, however, even after using the code from the growl demo here, I have been unable to trigger the popup.

Code:

<html lang="en">
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-growl/1.0.6/bootstrap-growl.min.js"></script>
</head>
   <body>
      <div class="container text-center">
        <button class="success btn btn-success">Success</button>

      </div>
 <script>
   $(".success").click(function(){
     $.bootstrapGrowl('You clicked this alert.',{
        type: 'success',
        delay: 2000,
     });
   });
</script>


</body>
</html>

The code is exactly the same in the demonstration, however, it is not producing a popup. Can anyone suggest another solution or a modification of the code above?


Solution

  • Hey @Ajax1234 i`ve tested your code on codepen. You have wrong html tags on 2 and 3 line you dont close the '>' script tag. If you close it , it runs perfect. e.g

    <script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-growl/1.0.0/jquery.bootstrap-growl.min.js"></script>
    

    Kindly note, jquery should be above boostrap.js since it requires it. Regards,