Reputation: 9024
This is a simple toggle. The weird thing is that, the event happens when I click anywhere.
This is what my jquery code looks like:
$(document).on('click', $('#create_customer'), function(){
$('#create_customer_form').slideToggle('slow');
})
Here is a jsfiddle: https://jsfiddle.net/p8q0uw80/
Upvotes: 0
Views: 31
Reputation: 1194
try this
$(document).ready(function(){
$('#create_customer').click(function(){
$('#create_customer_form').slideToggle('slow');
});
} );
and you can simply do
$(document).on('click', '#create_customer', function(){
$('#create_customer_form').slideToggle('slow');
})
Upvotes: 0
Reputation: 484
$(document).on('click','#create_customer', function(){
$('#create_customer_form').slideToggle('slow');
});
Upvotes: 1
Reputation: 5437
Your selector should be something like this:
$(document).on('click', '#create_customer', function(e){
$('#create_customer_form').slideToggle('slow');
});
Updated your fiddle
https://jsfiddle.net/p8q0uw80/5/
Upvotes: 2