Javascript DOM CSS Style listStyle Property set

Introduction

Change the type and position of a list to "square inside":

document.getElementById("myList").style.listStyle = "square inside";

View in separate window

<!DOCTYPE html>
<html>
<body>

<ul id="myList">
  <li>CSS</li>
  <li>HTML</li>
  <li>SQL</li>
  <li>C++</li>
</ul>//w  w  w.  j av a2 s  . co m

<button type="button" onclick="myFunction()">Change list style</button>

<script>
function myFunction() {
  document.getElementById("myList").style.listStyle = "square inside";
}
</script>

</body>
</html>



PreviousNext

Related