When we write the registration page, the required information is visible and the optional information is hidden. If the user wants to fill it in, they can click "Details".
Copy the code code as follows:
<!-- The following code uses javascript to display and hide information -->
<!DOCTYPE html>
<html>
<head>
<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 = '';
}else{
$('text').style.display = 'none';
}
}
</script>
</head>
<body>
<div id="text" style="display:none;">Here is the hidden information</div>
<button id="morebtn" onclick="showtext();">Details</button>
</body>
</html>