[jQuery] jQuery toggle at first click
This is my jQuery code:
$(document).ready(function()
{
$('.show_hide').click(function()
{
$(this).toggle(function()
{
alert('1');
},function() {
alert('2');
});
});
});
This code set an event listener on two DIV with class .show_hide. Now,
I click on first div and nothing happen. I click again and alert box 1
pop-up. This is strange , why statement run only at second click ?
Thanks!