1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<!-- HTML -->
<li id="tool-search">
<form action="search.php" method="GET" id="recherche" class="formulaire_recherche">
<input type="text" id="search" name="search" value="{L_SEARCH}" class="span-4" />
<input type="submit" value="OK" class="fg-button ui-state-default ui-corner-all" />
</form>
</li>
//JS
/* ----------------------
| SEARCH FOCUS IN/OUT
---------------------- */
var search = $('#tool-search input:first-child');
search.focus(function() {
//if ($(this).attr('value') == 'search...') $(this).attr('value', '');
if ($(this).val() == 'search...' || $(this).val() == 'recherche...' ) {
$(this).val('');
}
try { origCol } catch(e) { origCol = $(this).css('color'); }
$(this).css({color: '#333', fontWeight: 'normal'});
});
search.blur(function() {
if ($(this).attr('value') == '') {
$(this).attr('value', 'search...');
$(this).css({color: origCol, fontWeight: 'bold'});
}
}); |
seule
$(this).val() == 'search...'
est détectée.
Merci d'avance
Partager