Amy Amy - 2 years ago 273
jQuery Question

Error javascript

In console, I have this error. I use the latest jquery 3.1.

How to rectify this element ?

Thank you

typeError: window.on is not a function

<script>(window).on('load', function (){var maxHeight=0;$(".equal-height").each(function(){if($(this).height()>maxHeight){maxHeight=$(this).height();}});$(".equal-height").height(maxHeight);});</script>

Answer Source

You need to use $ as a prefix to the (window) part of your script or it won't be a JQuery object.

<script>$(window).on('load', function (){var maxHeight=0;$(".equal-height").each(function(){if($(this).height()>maxHeight){maxHeight=$(this).height();}});$(".equal-height").height(maxHeight);});</script>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download