how does trim function works in jQuery code example Example: trim space in jquery var str = " Hello World! "; alert(str.trim());