Quantcast
Channel: MyClassBook
Viewing all articles
Browse latest Browse all 368

Change the Button Text & Button Action in SharePoint 2013

$
0
0

Hi friends, in this short tutorial we are going to learn: How to change the button text in SharePoint 2013 by using content editor web part. We will also learn how to change the action performed by that button.

Change Button Text in SharePoint 2013

Let us take an example for changing the text of “Close” button to “Back”. We will also change the action of this button. Initially “Close” button action is closing the current item/task etc. So will change the button to “Back” and it will take user to previous page.

Before proceeding further make sure that we are using javascript for making these changes. So you need to upload jquery.min.js and sputility.min.js files in your document library. I have used Shared Documents library for these files. You can read this article for your reference on how to upload and get the links of those files.

Use the following script for changing the text of button in newitem.aspx or any other page.

<script src="/examplesite/Shared%20Documents/jquery.min.js"></script>
<script src="/examplesite/Shared%20Documents/sputility.min.js"></script>
<script>
 $(document).ready(function(){
 {
  $("input[value$='Close']").attr('value', "Back");
  $("input[value$='Back']").click(function(){
   window.location.href = 'javascript:javascript:history.go(-1)';
  });
 };
});
</script>

In this code,

$("input[value$='Close']").attr('value', "Back");

will change “Close” button text to “Back”.

$("input[value$='Back']").click(function(){ 
  window.location.href = 'javascript:javascript:history.go(-1)'; 
});

This function will change the action for “Back” button which will go to previous page.

If you like this article, please share it with your friends and like or facebook page for future updates. Subscribe to our newsletter to get notifications about our updates via email. If you have any queries, feel free to ask in the comments section below. Have a nice day!

The post Change the Button Text & Button Action in SharePoint 2013 appeared first on MyClassBook.


Viewing all articles
Browse latest Browse all 368

Trending Articles