Marky Mark
Marky Mark

Reputation: 103

fadeOut() isn't working ? Why?

I'm trying to fade element out using jquery .... no luck

HTML element I'm struggling to fade out:

<div class="alert alert-success" id='success' style='margin-top: 
20px;width:320px;' role="alert"><strong>Done.</strong><br>
    Comment updated.</div>

Jquery bit:

<script type="text/javascript">

    $(document).ready(function(){
       $('#success').click(function() {
       $(this).fadeOut();
   });
});
</script>

and I'm using this cdn to pull Jquery from Jquery servers:

  <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"
integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
 crossorigin="anonymous"></script>

Any idea why this is not working ?

Upvotes: 1

Views: 1223

Answers (1)

Matthew Thurston
Matthew Thurston

Reputation: 760

as @ManuelOtto mentioned jQuery slim library does not include fadeOut. I was able to get your code to work with the following library

<script src="https://code.jquery.com/jquery-3.1.0.js"></script>

jsbin

Upvotes: 2

Related Questions