This will help you to find out if a page is in Edit Mode from JavaScript Place the below code in your Content Editor Web part ...