Reputation: 8734
For some reason the postback event keeps firing for my button. If I place a break point on the function(e) part with Firebug, the code just skips right over the function. Return false does not work either.
<script>
$(document).ready
(
$('#<%:FilterButton.ClientID %>').click
(
function (e)
{
e.preventDefault();
$('#Filter').toggle();
}
)
);
</script>
Edit: Kundan and others have pointed out that I skipped passing in an anonymous function for the document.ready() event. Careless on my part.
Upvotes: 1
Views: 266
Reputation: 13730
I think you have a few issues with your code, unless it was just a bad copy/paste job. Should be:
$(document).ready(function(){
$('#<%=FilterButton.ClientID %>').click(function(e){
e.preventDefault();
$('#Filter').toggle();
});
});
Upvotes: 1
Reputation: 14292
Try this
<script>
$(document).ready(function() {
$('#<%= FilterButton.ClientID %>').click(function (e){
e.preventDefault();
$('#Filter').toggle();
return false;
});
});
</script>
Upvotes: 3
Reputation: 449
Change
$('#<%:FilterButton.ClientID %>').click
to
$('#<%=FilterButton.ClientID %>').click
Upvotes: 0