As per jquery 3.5 documentation jquery.trim() is deprecated.
But when I try to use it with jquery 3.5 it's still working. Should I replace it with native trim function immediately or still can use jquery trim for a while.
As per jquery 3.5 documentation jquery.trim() is deprecated.
But when I try to use it with jquery 3.5 it's still working. Should I replace it with native trim function immediately or still can use jquery trim for a while.
Deprecated does not mean removed, it means that in a future version there is no guarantee that this method will still exist.
As per the jquery trim docs:
Note: This API has been deprecated in jQuery 3.5; please use the native String.prototype.trim method instead.
Docs for String.prototype.trim
It appears that there is a change in how this function is now being called. For codes using jQuery 3.5 and below, the usual function call works:
let xString = " This is my string with spaces ";
let xTrimmed = xString.trim();
But for codes using jQuery 3.5 upwards:
let xString = " This is my string with spaces ";
let xTrimmed = $.trim(xString);