Using toogle to show/hide the div, I've got a problem that when I hide my div with anothor function, I have to click twice on the button to perform correct action.
Is there any way change the toggle switch like I clicked the button?
$('#add_task').toggle(function() {
if ($("#new_task_status").attr("value")==0) {
$("#new_task").slideDown();
$("#new_task_status").attr("value", "1");
}
}, function() {
if ($("#new_task_status").attr("value")==1) {
$("#new_task").slideUp();
$("#new_task_status").attr("value", "0");
}
});
$('nav').click(function() {
if ($("#new_task_status").attr("value")==1) {
$("#new_task_status").attr("value", "0");
$("#new_task").slideUp();
}
});