.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Easy Web
Imran Ghani

Home >> Code Snippets >> JQuery >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Remove spaces from string using JQuery Trim()

Posted By:Amit Mehra       Posted Date: March 10, 2010    Points: 10    Category: JQuery    URL: http://www.dotnetspark.com  

Remove white spaces from string using JQuery using trim() function in asp.net. This function will be used when you need to trim or delete spaces.
 

JQuery.trim() function is used to trim white spaces embedded along with the string . It will remove the spaces before and after the string.

syntax

var str = jQuery.trim("your string which need to be trim");

Lets see how to use it


    
    // Add JQuery Reference
    
    
    
    

In the above example i have used html button click and I am trimming the string.


     

Further Readings:

Responses
Author: Virendra Dugar         Company URL: http://www.dotnetspark.com
Posted Date: April 18, 2011

Hi,

Thanks for the useful article.

using Trim(), you can also check whether item is empty or not. See below link.

http://jquerybyexample.blogspot.com/2010/08/jquery-tip-how-to-check-if-element-is.html

http://jquerybyexample.blogspot.com/2010/08/how-to-remove-space-from-begin-and-end.html

Thanks,
Virendra



Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend