Code: Select all
<!-- Search Form -->
<div id="searchnew">
<span class="close">X</span>
<form role="search" id="searchform" action="index.php?route=product/search" method="get">
<input value="" name="search" type="search" placeholder="What are you looking for?">
</form>
</div>
<script>
$(document).ready(function(){
$('a[href="#search"]').on('click', function(event) {
$('#searchnew').addClass('open');
$('#searchnew > form > input[type="search"]').focus();
});
$('#searchnew, #searchnew button.close').on('click keyup', function(event) {
if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {
$(this).removeClass('open');
}
});
});
</script>
How would i get this to work properly? Any ideas?
Many thanks
Eddy