My search bar is not working correctly.
I have it in my top bar which the id is firstnbar.
I can not seem for work it out in my common.js file.
<form class="navbar-search">
<div class="input-append">
<input name="search" type="text" placeholder="Search Our Store" value="<?php echo $search; ?>" >
<button type="submit" class="btn btn-inverse"><i class="icon-search icon-white"></i></button>
</div>
</form>
$(document).ready(function() {
/* Search */
$('#firstnbar .navbar-search button').bind('click', function() {
url = $('base').attr('href') + 'index.php?route=product/search';
var search = $('input[name=\'search\']').attr('value');
if (search) {
url += '&search=' + encodeURIComponent(search);
}
location = url;
});
$('#firstnbar .navbar-search input[name=\'search\']').bind('keydown', function(e) {
if (e.keyCode == 13) {
url = $('base').attr('href') + 'index.php?route=product/search';
var search = $('input[name=\'search\']').attr('value');
if (search) {
url += '&search=' + encodeURIComponent(search);
}
location = url;
}
});