[ad_1]
Inserting this line of code before .hide() fulfilled my requirement.
if ($(this).parent().is(":visible")) {
$(this).hide();
}
else {
$(this).show();
}
[ad_2]
solved search script in jquery