New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with change event inside a form #80
Comments
Hello there, Thank you for using our products, if you will initialize the function like this:
the problem of infinite loop onChange will be solved. Best, |
It worked for me, only when I edited bootstrapMaterialDesign function initialization directly in my project file material-dashboard.min.js |
$(document).on('input', '.form-control', function(){ By using the input event, the console log will only be triggered when the value of the input element actually changes, preventing the infinite loop when focusing on the element without any value change. |
Prerequisites
Add below code to see the unexpected behavior
$(document).on('change', '.form-control', function(){
console.log(1);
});
Expected Behavior
With below code Expected Behavior is to get the console every time on value change (change event)
$(document).on('change', '.form-control', function(){
console.log(1);
});
Current Behavior
But getting the console log infinite times on focus of the element even without the value change. This is happening with every element(like textbox, textarea, radio, checkbox and every element) inside a form which is bind with "change" event.
$(document).on('change', '.form-control', function(){
console.log(1);
});
Failure Information (for bugs)
On adding "change" change event with form element inside a form causing issue. Event triggered infinite times just focusing on the element. Its is working fine without the form tag.
Steps to Reproduce
$(document).on('change', '.form-control', function(){ console.log(1); });
3. Now focus on first input control. Actually in documentation first two sections( "Overview" & "Form controls") are inside a form. So check within these blocks, you will get the raised issue. ![error](https://user-images.githubusercontent.com/1376383/44834754-43d80780-ac5c-11e8-963f-536bfec100f8.jpg)The text was updated successfully, but these errors were encountered: