Text fields allow users to input, edit, and select text.
Text fields typically reside in forms but can appear in other places, like dialog boxes and search.
//
// Que du Css, pas de JS mais compatibilité pas au top ...
// Le selecteur :placeholder-shown est encore très mal supporté helas.
// https://www.w3.org/TR/selectors-4/#placeholder
// https://caniuse.com/#feat=css-placeholder-shown
//
// La meilleur solution est de gérer le focus soit en JS soit avec l'ajout d'une classe soit avec le selecteur
// input:not([value=""]):not(:focus) + label
$('.material-input-field').on({
focusout: function(){
$(this).removeClass('is-focus');
},
focusin: function(){
$(this).addClass('is-focus');
},
keyup: function() {
$(this).attr('value', $(this).val());
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.