Simple jQuery toggle() and return false inside click()
Posted
by Casey Stark
on Stack Overflow
See other posts from Stack Overflow
or by Casey Stark
Published on 2010-04-19T19:56:39Z
Indexed on
2010/04/19
20:03 UTC
Read the original article
Hit count: 289
jQuery
I'm mostly a djangonaut and phper, but I'm getting javascript development.
I've been looking at this very simple block for a feedback widget on a page. The code is pretty self-explanatory.
<a id="feedback-widget-toggle" href="[feedback_url]">Feedback</a>
<div id="feedback-widget">
<form method="POST" action="[form_url]">
...
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$("#feedback-widget-toggle").click(function() {
$("#feedback-widget").toggle("slide", {}, 500);
return false;
});
});
</script>
It's really simple. So simple that I feel pretty dumb for this one.
The jQuery is just supposed to disable the link and slide out the feedback-widget div. That's it. I'm new to jQuery, so it's probably some very simple syntax error that I'm not sure how to debug well enough.
Thanks.
© Stack Overflow or respective owner