Open basanthalluri opened 6 years ago
React doesn't work well when used with other libraries. jQuery and Materialize are no exception. Now, you have two options if you don't want to struggle more and more for every component you'll do :
I know this probably isn't the answer you expected, but I still hope it will help you !
And for next posts, after pasting your code, select it and click the Insert code icon so it is more readable for everyone !
one example: $(this.refs.your_select).material_select(this._handleChange.bind(this))
I am trying to get the value from the select drop down through onChange action but the function not calling in react.
Here is my sample code for select drop down
Here is my react code
handleInputChange (event) { alert("testing") // event.persist(); this.setState((state) => { state.registerForm[event.target.name] = event.target.value }); }
componentWillMount(){ console.log("executed") $(document).ready(function () { $('.dropdown-button').dropdown({ constrainWidth: false, hover: true, belowOrigin: true, alignment: 'left' }); $('select').material_select(); $('.dropdown-button').dropdown({ constrainWidth: false, hover: true, belowOrigin: true, alignment: 'left' }); $('.button-collapse').sideNav();
}); }