Error with JS missing identifier under IE

  • 2020-03-30 03:36:15
  • OfStack

According to the number of error lines to find the source code, also can not see where there is a problem, it looks like there is no lack of what ah, the code is as follows:


if (opts.display.class != '') {
  $(list).addClass(opts.display.css);
}

This sentence is the display of the objects of judgment opts there is not a class attribute value, otherwise, do the corresponding processing, grammar is right, then the Internet search, only to find that the original Internet explorer to JS grammar is quite harsh requirements, because the class is JS keywords, such as use this as a variable, IE will be submitted to the above mistake, alas!

Since this is a plug-in for jQuery, fortunately not much has changed, as long as you change the names of the variables that use this property.

In this is to introduce this plug-in, feeling is very good, this plug-in called imList, that can help you to batch generated HTML elements and code, and there's a very rich regular template replace function, used to interact with the server after dynamically generated HTML interface corresponding occasions, interested friends may to its website for details

(link: http://grasshopperpebbles.com/ajax/jquery-plugin-imlist/)


Related articles: