Comments (3)
I discovered that, like #9, setting prioritize: 'placeholder'
and inserting the text into the placeholder directly allowed this to work, but this still seems like bizarre behavior.
from float-labels.js.
Float-labels only extracts the text content of the label instead of the full html content, it does this to avoid possible compatibility issues with unforeseen LABEL markup. It also removes any existing asterisk or colon.
Removing the asterisk from the label allows for more flexible styling options (see https://geminilabs.github.io/float-labels.js/), however, it's very easy to put back with CSS:
.fl-is-required label.fl-label::after {
content: '\2009\002a';
}
from float-labels.js.
Ok I've released v3.2.0. This version improves the placeholder logic for SELECT fields and adds a customPlaceholder
callback option. You can now do the following:
const floatlabels = new FloatLabels( '.form-1', {
// append an asterisk to the labels of required fields
customLabel: function( labelEl, el ) {
return labelEl.textContent + ( el.getAttribute( 'required' ) !== null ? ' *' : '' );
},
// append an asterisk to the placeholders of required fields
customPlaceholder: function( placeholderText, el ) {
return placeholderText + ( el.getAttribute( 'required' ) !== null ? ' *' : '' );
},
});
from float-labels.js.
Related Issues (20)
- Rebuild only one field instead of entire page? HOT 1
- Setting field value through javascript doesn't show the label HOT 1
- webpack example HOT 1
- Module Support HOT 1
- Issue select multiple HOT 1
- Bundling float-labels.js with webpack HOT 2
- Problems with typescript HOT 2
- Uncaught TypeError: Cannot read property 'defaultSelected' of undefined
- Chrome V66 placeholder doesn't dissapear on-focus HOT 1
- invalid css property
- get attribute value in modal dialog HOT 6
- ng-model issue in angularjs HOT 2
- float-labels.js plugin and datepicker HOT 3
- Replacing colon with empty string HOT 1
- RTL Support HOT 1
- Label active when element is in focus HOT 2
- (Bug) Autocomplete HOT 3
- Not Used floatlabels.rebuild(); HOT 3
- jquery datepicker HOT 1
- import FloatLabels from 'float-labels.js' doesn't seem to import HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from float-labels.js.