1
function changedisplay()
{
var x = document.getElementsByTagName('li');
if (x.style.display == 'none')
{
x.style.display = 'block';
}
else
{
x.style.display = 'none';
}
}
<!DOCTYPE html>
<html>
<HEAD>
<meta charset='utf-8'>
<script type='text/javascript' src='script.js'></script>
<style>
li
{
display: none;
}
</style>
</HEAD>
<body>
<button onclick="changedisplay()">mudar</button>
<ul>
<li name='li'>ASDASD</li>
<li name='li'>ASDASD</li>
<li name='li'>ASDASD</li>
</ul>
</body>
</html>
I’m trying to make a menu for mobile with a <ul>
by default is display: None, I want to change the msm block when the user clicks the Menu to give the effect and return to None when it is pressed.