Not working search only on mobile version of site. On desktop is working.
Looks like search id for desktop and mobile versions of site the same because of that the problem.
How to improve code for solving this problem?
Thanks in advance!
catalog>view>javascript>bossthemes
bossthemes.js
catalog>view>javascriptvar isMobile = /iPhone|iPod|iPad|Phone|Mobile|Android|hpwos/i.test(navigator.userAgent);
var isPhone = /iPhone|iPod|Phone|Android/i.test(navigator.userAgent);
jQuery(document).ready(function($) {
$('#search input[name=\'search\'], #mobile-header-search input[name=\'search\']').on('keydown', function(e) {
if (e.keyCode == 13) {
$('header input[name=\'search\']').parent().find('.button-search').trigger('click');
}
});
/* Tooltip */
common.js
/* Search */
$('.button-search').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;
});
$('#header 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;
}
});
/* Ajax Cart */ /* Search */
$('.button-search').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;
});
$('#header 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;
}
});
/* Ajax Cart */
headr.tpl
<?php } ?>
</div>
<div id="search-block" class="col-lg-10 col-md-10 col-sm-10 col-xs-10">
<div class="boss_search">
<div id="search">
<div class="button-search"></div>
<input type="text" name="search" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" autocomplete="off" />
</div>
<?php