简体   繁体   中英

How to hide a button on portal page when the page loads and display it later when clicked on other button

I am pretty new to CRM and Portals.

I want to know how to hide a button on portal page when the page loads and display it later when clicked on other button.

I have created these buttons on my Entity list as I am displaying view from an entity on portal.

You can use a css, javascript or jquery in this kind of instances for example this code might help you. I set the button to appear slowly after a delay of 3 seconds.

 setTimeout(function(){ var x = document.querySelector('.hidden-btn'); x.style.WebkitTransition = "all 2s" // for safari. x.style.transition = "all 2s"; // for chrome. x.style.opacity = 1; // you can either use opacity or block }, 3000); // 3000 is equivalent for 3 seconds
 .hidden-btn{opacity: 0;} /* you can either use opacity or display: none here */
 <button class="hidden-btn">Hidden Button</button>

I would just use jQuery to show the initially hidden button when another button is clicked. Set to hidden from the start with css and then show it whenever you want using the jquery.show() function.

The number in the.show() function is the speed for showing the button. 1000 = 1 second. If you want it to show instantly just take the number out.

Good luck.

 $(document).ready(function() { // show the hidden button when another button is clicked. $("body").on("click", ".showHiddenButton", function() { $("#hiddenButton").show(1000); }); });
 #hiddenButton { display: none; background: orange; }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <button id="hiddenButton">INITALLY HIDDEN BUTTON</button> <button class="showHiddenButton">Show Hidden Button</button>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM