Skip to main content

Tips for Noteboard webpart in sharepoint 2010

In noteboard webpart, when there are no comments, there is text that appears as shown

Add the following javascript in the page layout
<script type="text/javascript">
   $(document).ready(function() {
            HideCommentText();
     });
    function HideCommentText() {
            if ($("div :contains('There are no notes posted yet. You can use notes to comment on a page')").length == 0) {
                setTimeout(HideCommentText, 50);
            }
            else {
                $("div :contains('There are no notes posted yet. You can use notes to comment on a page'):last").html("");
            }
     }      
 </script>

--------------------------------------------------------------------------------------------------------------------------------
If you need to add some other text when no comments are there, you can add that to html tag , for e.g.  "Enter comments here" text can be added by the following script

<script type="text/javascript">
   $(document).ready(function() {
            HideCommentText();
     });
    function HideCommentText() {
            if ($("div :contains('There are no notes posted yet. You can use notes to comment on a page')").length == 0) {
                setTimeout(HideCommentText, 50);
            }
            else {
                $("div :contains('There are no notes posted yet. You can use notes to comment on a page'):last").html("Enter comments here");
            }
     }      
 </script>

Comments

  1. I added this to my custom page layout but it doesnot work. where exactly this should come. Custom page layout is of Enterprise wiki page type

    ReplyDelete

Post a Comment