"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Tuesday, March 29, 2011

trim() in javascript and jquery

Hai *.*,
Here i'm presenting a simple tip over trim() on JavaScript and jquery.


using jQuery
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
var _str = “   My string ";
var _String = jQuery.trim(_str);

Trim() in javascript
var _str = "   My string ";
var _String = _str.trim();

hope u understood it.
Stay tune... 
Have a nice day... 'N happy Coding :)

No comments: