Return to Snippet

Revision: 37293
at December 8, 2010 02:14 by errkk


Initial Code
// Put text in the search box and remove it and change the colour when it needs to be used.
function search_text()
{
    var search_advice_text = $('#f_search').siblings('label').text();


    $('#f_search').val( search_advice_text ).css({'color':'#ccc'});

    $('#f_search').focus(function(){
        if( $(this).val().length == 0 || $(this).val() == search_advice_text ){
            $(this).val( '' ).css({'color':'#444'});
        }
    }).blur(function(){

        
        if( $(this).val().length == 0 ){
            $(this).val( search_advice_text ).css({'color':'#ccc'});
        }
    });

}

Initial URL


Initial Description


Initial Title
Search Input text

Initial Tags
search, text

Initial Language
jQuery