bootstrap: Error when calling $('.fileinput').fileinput('reset')
Everytime I call $('.fileinput').fileinput('reset') I get this error SyntaxError: Invalid regular expression: /(^|\.)bs\.(?:.*\.|)fileinput(\.|$)/: Stack overflow. Does anybody know what could be causing this?
I am on Bootstrap 3.0.3, Download the Extend version of Jasny/bootstrap and am using the Input File control.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 22 (2 by maintainers)
Can we please get this fixed. This has been open for over year. Easy solution: just rename the event to
resetted.bs.fileinputor getting rid of the event entirely. After all one could still listen to the form’sresetevent if need be.The file input code is listening for a form reset with the event type of
reset.bs.fileinput. When that happen, it calls thereset()function which at the end trigger a reset on the.fileinputelement with the same event typereset.bs.fileinput. This, as you already know, causes an infinite loop/recursion, aka stack overflow.I’m unsure of the best way to solve this but here are 2 ways:
reset.bs.fileinputto something else to avoid the listening & triggering collision.