MyBB Community Forums

Full Version: Error is not a function on viewing thread page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I load a thread I notice following error on the browser developer console:

TypeError: $(...).error is not a function thread-10.html:810:27
    <anonymous> https://mydomain.tdl/forum/thread-10.html:810


When I click it it takes me to this line of code that fires the error:
<script type="text/javascript">
$(".author_avatar img").error(function () {
$(this).unbind("error").closest('.author_avatar').remove();
});
</script>
"error" is deprecated in Jquery 3 and MyBB uses 3.3.1.

The script in showthread template should instead be like this:

<script type="text/javascript">
$(".author_avatar img").on('error', function () {
    $(this).unbind("error").closest('.author_avatar').remove();
});
</script>
I will send a PR
(2019-12-27, 07:57 PM)enespalit Wrote: [ -> ]
<script type="text/javascript">
$(".author_avatar img").error(function () {
$(this).unbind("error").closest('.author_avatar').remove();
});
</script>

I guess the whole part was removed in mybb 1.8.21 or earlier version.
^ yes, it should have been already removed [in MyBB 1.8.20]
Thank you, it was a custom theme that was not currently changed the code so I manually changed it.

Thanks again!