Reputation: 1472
I've written a code which checks if the div is set to display:none;
or display: block;
, but I think a better short code can also be made. Here is my code, can anyone help me out with a more flexible code?
$(".msgstreplylarge").toggle(
function () {
if($('.view_quick_reply').css('display') === 'none')
$('.view_quick_reply').show();
else
$('.view_quick_reply').hide();
},
function () {
if($('.stg_gall_cro_cnt').css('display') === 'block')
$('.view_quick_reply').hide();
else
$('.view_quick_reply').show();
}
);
Upvotes: 0
Views: 106
Reputation: 57322
$('#foo').toggle(showOrHide);
will do the same work . for further reference check this link
Upvotes: 2