i'm making a wordpress theme with a slide out search box. I would like to hide/toggle the search box by clicking away. Here is my javascript
jQuery(document).ready(function($){
$("#flip").click(function(){
$("#searchbox").toggle("slide", { direction: "right" }, 500);
});
$("#flip2").click(function(){
$("#searchbox").toggle("slide", { direction: "right" }, 500);
});
});
jQuery('body').on('click', function(e){
{
$("#searchbox").toggle("slide", { direction: "right" }, 500);
});
jQuery('#searchbox').click(function(e)
{
e.stopPropagation();
});
I get an unexpected token error when trying this. Thanks for your help