Search icon on click popup search box
<p>I'm having troubles with icon and popup when icon is pressed. Here's part of the code:</p>

<pre><code>&lt;div class="searchlink" id="searchlink"&gt;
   &lt;i class="fa fa-search fa-custom"&gt;&lt;/i&gt;
   .... 
&lt;/div&gt;
</code></pre>

<pre class="lang-js prettyprint-override"><code>$(function() {
    var $searchlink = $('#searchlink');

    $searchlink.on('click', function(e) {
        var target = e ? e.target : window.event.srcElement;
        if ($(target).attr('id') == 'searchlink') {
            if ($(this).hasClass('open')) {
                $(this).removeClass('open');
            } else {
                $(this).addClass('open');
            }
        }
    });
});
</code></pre>

<p>Full code: <a href="https://jsfiddle.net/as2joj4g/" rel="nofollow">jsfiddle</a></p>

<p>It is not showing when I press the icon, it shows if I press around icon. What should I change? Thanks.</p>