When doing a project, select2, the beautification plug-in of select, is generally an easy-to-use plug-in. However, I encountered a small problem in the process of using. A group of select dynamically generated by JS was not initialized successfully, that is to say, the initialization method of select2 was not bound to the unknown element. I tried to initialize again in the trigger event, and the result was uncaught query function not defined for select2 s2id_ Stores’ fault
The reason is that the same object cannot be initialized twice, so a method is written
function attachSelect2(event){
event.find(“#lesson”+i).select2({
width:”100%”,
minimumResultsForSearch: -1
})
}
Lesson is the ID that I set for a group of select, then I + + set different ID for each select in the trigger event, and then initialize different ID, which is successful~
Similar Posts:
- Error: not a group by expression [How to Solve]
- Oracle trigger error: ORA-04098 [How to Solve]
- Can’t create handler inside thread that has not called Looper.prepare()
- [Solved] must appear in the GROUP BY clause or be used in an aggregate function
- The applet reports an error thirdscripterror DateValue is not defined;
- sorry, unimplemented: non-trivial designated initializers not supported
- Eclipse SVN is already locked solution
- [How to Solve] Uncaught ReferenceError: app is not defined
- event.srcElement And event.target The difference between
- MYSQL Error: Invalid use of group function [How to Solve]