Monthly Archives: June 2016

Select atleast two check box No ratings yet.

If you want to force user to select at least two check box among several check box. You can do it like this:

 

Likes(0)Dislikes(0)

Please rate this

Find Number of Characters in string No ratings yet.

We can find the number of characters in a string using the length property of JQuery as follows:

 

 

Likes(0)Dislikes(0)

Please rate this

Remove Spaces from String No ratings yet.

You can do it using the trim function of JavaScript:

 

Likes(0)Dislikes(0)

Please rate this

All posts No ratings yet.

Here is the list of all the articles:

  1. Trim string using JavaScript
  2. Remove element from array by value using JavaScript
  3. Get current user information in SharePoint using JavaScript
  4. Remove SharePoint app part using JavaScript
  5. Resize SharePoint App part using JavaScript
  6. Check user Permission in SharePoint using JavaScript
  7. Accept only numbers from user using JavaScript
  8. Truncate string to nearest white space using JavaScript
  9. Selecting dropdown element using JavaScript or JQuery

 

Likes(0)Dislikes(0)

Please rate this

Trim string using javascript No ratings yet.

You can do this using various techniques. Some of them are as follows:

Method 1: Using Plain Javascript:

You can do it using the simple simple Javascript expression as follows:

Output:

 

Method two: Using trim() function of Jquery:

In order to trim a string, firstly you can use the $.trim() function of Jquery to make the input string neat(removes all newlines, spaces and tabs from the beginning and end of the supplied string).

Since you would be using the $.trim() function of Jquery, don’t forgot to include the library file of Jquery:

And here is a simple solution to this task :

Output:

 

And if you want to truncate a string to nearest white space using javascript, you can refer this article :

Truncating string to nearest white space using Javascript .

 

Likes(2)Dislikes(0)

Please rate this