I want to do a simple animation clicking on this link
<a id="C" href="http://www.google.com">Make me disappear</a>
Callback is
$("#C").click(function(event) {
event.preventDefault();
$(this).hide("slow");
});
while on jfiddle my code works, I am not able to make run this callback on a jsp page. I wrote js code in a different file imported with
<script type="text/javascript" src="scripts/lib.js"></script>
I am quite sure jQuery and lib.js are being included because from developer tools console (on Chromium) I can make it do the animation; moreover they are both in developer tools’ scripts tabs.
Thanks
Notice that on jfiddle it’s including your jQuery click handler in the page’s
onloadfunction; are you doing that in your lib.js file?(Using
$(function() {});is a shorthand for running that code when the DOM is ready – see the jQuery .ready() documentation.)Or even better:
to be able to handle possible future conflicts.