How to display placeholder text on focus?

I have the following placeholder:

 <div class="input-text-container search" style="display:none;">
    <input type="text" id="textSearch" class="input-text-big search-message" placeholder="Search in your list"/>
    <i class="common-sprite cross search"></i>
</div>

The input is displayed when the user clicks on an icon with the class “search.icon-search”

I use the following JS code:

 $('.search.icon-search').on(
        'click',
        function(e) {
            e.preventDefault();
         $('#textSearch').focus()
        });

The problem is that the placeholder disappears on focus. How can I display it even on focus?


Source: html5

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.