jQuery addClass example
Change class name on click in jQuery
by sanat gupta
HTML
<span class="fly-search-icon">1</span>
<form id="fly-search-form" style="display:none" method="get" id="header-searchform" role="search" action="">
<div class="fly-search-item">
<span class="fly-search-cancel">X</span>
<input type="hidden" name="post_type" value="product" />
<input type="text" class="fly-search-input form-control" name="s" placeholder="Search...">
<input class="fly-submit-btn" value="" type="submit"/>
<span class="fly-search-submit fa fa-search fa-fw"></span>
</div>
</form>
JavaScript
$('.fly-search-icon').click(function(e){
e.preventDefault();
$('#fly-search-form').show();
$('.fly-search-input').trigger('touchstart');
$('.fly-search-input').on('touchstart', function() {
alert();
$(this).focus();
});
})