question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

material_select is not a function

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
fengxia41103commented, Sep 22, 2017

So to fully make this work:

  1. Make sure there is no Bootstrap loaded.
  2. in main.js,
import 'materialize-css/dist/js/materialize.min.js'
import 'materialize-css/dist/css/materialize.min.css'
  1. in your.js,
import $ from 'jquery' //this one is not needed if your eslint is disabled
import { Button, Card, Row, Col, Input, Modal, Icon } from 'react-materialize';
2reactions
alvaradovexcommented, Jun 7, 2018

If you are using latest version´s Materialize, you should change in your js.

/*older $(‘select’).material_select(); $(‘#select’).material_select(); */ /newer/ $(‘select’).formSelect();

Read more comments on GitHub >

github_iconTop Results From Across the Web

materialSelect is not a function - Material Design for Bootstrap
materialSelect is not a function. I am using $('.mdb-select').materialSelect(); I Got working with html but when I put the same in cshtml for...
Read more >
Materialize material_select is not a function error
I am using materialize and trying to use material_select(). Here is my main page that has the jQuery and materialize library as well...
Read more >
Uncaught TypeError: $(...).material_select is not a function ...
material_select is not a function Recently I've tried Materialize with Vue2 and Meteor. However, I got a problem where i can't initialize ...
Read more >
I got $(...).material_select() is not a function - Vue Forum
I got $(...).material_select() is not a function ... i already try import 'jquery' but still not work. LinusBorg February 1, 2017, 2:15pm #6....
Read more >
Materialize - Selects - Tutorialspoint
... <script> $(document).ready(function() { $('select').material_select(); }); </script> </head> <body class = "container"> <div class = "row"> <form class ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found