Javascript implements the display and hiding of information such as the registration page

  • 2020-03-30 00:41:10
  • OfStack

When we write the registration page, the required information is visible, the optional information is hidden, if the user wants to fill in, you can click "details".
<!--  The following code is passed javascript Implement the display and hiding of information  --> 
<!DOCTYPE html> 
<meta charset="UTF-8"> 
<title>Insert title here</title> 
<script type="text/javascript"> 
function $(idvalue){ 
return document.getElementById(idvalue); 
function showtext(){ 
if($('text').style.display == 'none'){ 
$('text').style.display = ''; 
$('text').style.display = 'none'; 
<div id="text" style="display:none;"> Here is the hidden information </div> 
<button id="morebtn" onclick="showtext();"> The detailed information </button> 

Related articles: