To initialize the script Materialize Form
- Include materialize.css file
- Import ninja.js
- Import Materialize from materialize.js
- New Materialize().Form()
- Provide ID of form when newing
- Make sure all elements you want Materialized have
tabindexattribute on them. Without this they will be skipped over and not included in your new Materialize Form
<!DOCTYPE html>
<link href="Materialize/materialize.css" rel="stylesheet" />
<script type="module">
import "./Materialize/ninja.js";
import Materialize from "./Materialize/materialize.js";
// add to window scope so it can be access in console, if you want
window.NinjaForm = new Materialize( )
.Form( {
form: 'NinjaForm',
} );
</script>
<div id="NinjaForm">
<material text>
<label for="default-text-field"><span>Default Text Field</span></label>
<input type="text" id="default-text-field" name="default-text-field" value="" tabindex="1">
</material>
</div>