I have a toggle switch from this website CSS Toggle on one of my pages and I'm trying to make it hide and show a select2 box, like a toggle.
So on Document Ready I hide the secondary box, as it's not needed, then the logic for the toggle switch:
$( "#s2id_author-search" ).hide();
$( "#searchSwitch_btn" ).click(function(){
    if($("#s2id_author-search").css('display') === 'none') {
        console.log("Showing author search: 1");
        $("#s2id_author-search").show();
        console.log("Hiding title search: 2");
        $("#s2id_title-search").hide();
    }
    else {
        $("#s2id_author-search").hide();
        console.log("Hiding author search: 3");
        $("#s2id_title-search").show();
        console.log("Showing title search: 4");
    }
});
When I click the toggle switch while looking at FireBug console, I can see all console.log messages showing up, which is telling me that the script is executing in its entirety, instead of just one or the other options.
P.S. I know using the toggle() command in jQuery is more efficient but this is how the code is now for troubleshooting.
Any ideas?
 
     
     
     
    