The jquery object does not support the on attribute or method because "document.write" rewrites the entire web page. The solution is to use jQuery's ".html and .text" to print to a certain tag.
The operating environment of this tutorial: Windows 7 system, jquery3.2.1 version. This method is suitable for all brands of computers.
Related recommendations: "jquery Video Tutorial"
jquery object does not support this property or method?
Originally there was no problem calling $ and jQuery, and the console could also print out $ and jQuery. However, after calling document.write, an error occurred:
$ 对象不支持此属性或方法 控制台也打印不出$了,报同样的错。
Cause: document.write reset the entire web page. After writing, the $ will of course disappear. To print, you can only print the text into a certain label.
JQuery’s .html .text can be used to print to a certain tag.
Note: Versions before jquery 1.7 do not support on. If you want to continue to support the on attribute or method, please use jQuery 1.7 or later.
The above is the detailed content of What should I do if the jquery object does not support on attributes or methods?. For more information, please follow other related articles on the PHP Chinese website!