To use your jQuery in Magento 2.x you can use below format jQuery code:
require(( 'jquery', 'jquery/ui'), function($){
$(document).ready(function(){
// put your code here if you want it in document.ready
$(':input').change(function() { $(this).val($(this).val().trim()); });
});
setTimeout(function(){
$(window).load(function(){
// Your code here
console.log("bla bla");
});
}, 2000);
});
Hope this will help you to achieve your requirements. Good Luck.
Ref: jQuery not working in checkout page – Magento 2