Author Archives: javascriptstutorial

Check if Sharepoint page is in edit mode No ratings yet.

To check whether the page is in edit mode or not we need to check value of parameter “MSOLayout_InDesignMode“.

Below is the JavaScript snippet using which we can easily check whether the page is in edit mode or not.

This will refer to value of the following html input control, which is rendering on the page when it is in edit mode:

Similary, for Wiki pages  you need to check _wikiPageMode parameter.

var wikiInEditMode = document.forms[MSOWebPartPageFormName]._wikiPageMode.value;

For publishing pages we can also check it using this:

This returns true or false.

 

 

 

 

 

Likes(1)Dislikes(0)

Please rate this

Get selected checkbox values No ratings yet.

In this article, we will see how to get all the selected checkboxes in array.

Before implementing this functionality in your webpage, make sure you have added the JQuery file:

Let’s consider we have below piece of HTML code :

Below is the JQuery or JavaScript snippet:

 

 

 

 

 

Likes(3)Dislikes(1)

Please rate this

Check device width height No ratings yet.

 

 

 

Likes(0)Dislikes(0)

Please rate this

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