jquery trim spaces - jQuery $.trim method
Posted by Raj
jquery trim spaces - jQuery $.trim method
In this tutorial, I will explain how to removes the two whitespaces at the start and at the end of the string.
Removes the two whitespaces at the start and at the end of the string.
<html>
<title>jquery trim spaces</title>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("span").click(function () {
var str = " jquery trim spaces ";
str1 = jQuery.trim(str);
alert(str1);
str2 = $.trim(str);//using the jQuery $.trim method
alert(str2);
});
});
</script>
</head>
<body>
<span>jquery trim spaces</span>
</body>
</html>
I hope this tutorial will help you to remove whitespaces at the start and at the end of the string.
In this tutorial, I will explain how to removes the two whitespaces at the start and at the end of the string.
Removes the two whitespaces at the start and at the end of the string.
<html>
<title>jquery trim spaces</title>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$("span").click(function () {
var str = " jquery trim spaces ";
str1 = jQuery.trim(str);
alert(str1);
str2 = $.trim(str);//using the jQuery $.trim method
alert(str2);
});
});
</script>
</head>
<body>
<span>jquery trim spaces</span>
</body>
</html>
I hope this tutorial will help you to remove whitespaces at the start and at the end of the string.
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
JAVASCRIPT,
JQuery,
jquery remove spaces,
jquery trim,
jquery trim spaces,
jquery trim string,
js trim whitespace,
leading and trailing spaces,
trim jquery,
trim spaces
.You can leave a response, or trackback from your own site.