Error on input with Material Design
-
I need to implement Material Design for a plugin with a simple HTML form that I have created. On functions.php of the GeneratePress child theme I have enqueue the necessary files:
function material_enqueue_style() { wp_enqueue_style( 'material-style', 'https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css'); wp_enqueue_script( 'material-script', 'https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js', '', null, true); } add_action( 'wp_enqueue_scripts', 'material_enqueue_style' ); function footer_add_material_icons() { wp_enqueue_style('material-icons', 'https://fonts.googleapis.com/icon?family=Material+Icons'); }; add_action( 'get_footer', 'footer_add_material_icons' );
However, I think that I also need to instantiate the JavaScript, the docs mention:
import {MDCTextField} from '@material/textfield'; const textField = new MDCTextField(document.querySelector('.mdc-text-field'));
How do I implement this?
Also, I tried using the official Material Design for WordPress plugin, but the result is the same.
No JS errors and the field is selected and styled. However, it won’t apply the required style and the floating label, so when I input, this is what happens:
See https://i.imgur.com/U49rSdK.png
Thank you
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Error on input with Material Design’ is closed to new replies.