Home >Web Front-end >JS Tutorial >Why does jquery not support live
The reason why jquery does not support live: According to the official description of jQuery, the live method is no longer recommended in [1.7]. This method was deleted in [1.9], and it is recommended to use on in future codes. method instead.
The reason why jquery does not support live:
According to the official description of jQuery, the live method is no longer available in 1.7 Recommended, this method was removed in 1.9. And it is recommended to use the on method instead in future code.
In the new version of jquery (>1.9 version is the new version), the live() method has been deleted, so when we call it, we will be prompted that the function does not exist and js will report an error. When using live, you should pay attention to the version of jquery. According to the official documentation, live and delegate
are no longer recommended starting from 1.7, and live will be removed in 1.9.
The previous live method is such as:
$("#con_imgs").live('change',function(){ v = $(this).val(); $("input[name='contentimg']").val(v); });
After jquery1.10, on can be used instead of live
$("#con_imgs").on('change',function(){ v = $(this).val(); $("input[name='contentimg']").val(v); });
The on method can accept three parameters: event name, trigger selector, event function.
Related free learning recommendations: JavaScript (video)
The above is the detailed content of Why does jquery not support live. For more information, please follow other related articles on the PHP Chinese website!