react-materialize: material_select is not a function
Followed doc for installation:
<body> <div id="app" /> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/js/materialize.min.js"></script><script type="text/javascript"
src="https://www.gstatic.com/charts/loader.js"></script>
<script src="bundle.js"
type="text/javascript"></script>
</body>
Trying to use Select
in jsx, error material_select
is not a function:
import React from 'react';
import { Button, Card, Row, Col, Input } from 'react-materialize';
....
return (
<Row>
<Input s={12} type='select' label="Materialize Select" defaultValue='2'>
<option value='1'>Option 1</option>
<option value='2'>Option 2</option>
<option value='3'>Option 3</option>
</Input>
</Row>
)
Help.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15 (6 by maintainers)
So to fully make this work:
main.js
,your.js
,If you are using latest version´s Materialize, you should change in your js.
/*older $(‘select’).material_select(); $(‘#select’).material_select(); */ /newer/ $(‘select’).formSelect();