locked
Powershell edit page RRS feed

  • Question

  • Hi 

    Is it possible to create a script that hits a lot of .aspx pages (check them out) and alter html code like the <label class="ms-hidden"> and remove the class="ms-hidden" so its just <label> 

    Thursday, December 6, 2018 2:02 PM

Answers

  • Hi,

    We can add the following Script code into <head/> in master page to achieve it.

    <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {    	    
       $("label.ms-hidden").removeClass("ms-hidden");
    });
    </script>

    Or we can use the Style below to override the default CSS.

    <style type="text/css">
    label.ms-hidden{
    	top:auto !important;
    	overflow:visible !important;
    }
    </style>

    If you only want to modify the pages in Site Page library, we can use the code below.

    <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    	if(window.location.href.indexOf("/SitePages/")!=-1){
    		$("label.ms-hidden").removeClass("ms-hidden");
    	}
    });
    </script>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by JmATK Friday, December 7, 2018 5:05 AM
    Friday, December 7, 2018 2:02 AM

All replies

  • Hi

    You can write script in master page.


    Justin Liu Office Servers and Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Friday, December 7, 2018 1:27 AM
  • Hi,

    We can add the following Script code into <head/> in master page to achieve it.

    <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {    	    
       $("label.ms-hidden").removeClass("ms-hidden");
    });
    </script>

    Or we can use the Style below to override the default CSS.

    <style type="text/css">
    label.ms-hidden{
    	top:auto !important;
    	overflow:visible !important;
    }
    </style>

    If you only want to modify the pages in Site Page library, we can use the code below.

    <script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {
    	if(window.location.href.indexOf("/SitePages/")!=-1){
    		$("label.ms-hidden").removeClass("ms-hidden");
    	}
    });
    </script>

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by JmATK Friday, December 7, 2018 5:05 AM
    Friday, December 7, 2018 2:02 AM
  • Thanks Dennis ! 
    Friday, December 7, 2018 5:06 AM