<!DOCTYPE html>
<html lang="en-US">
<body>
<ul><li>Honda</li><li>Yamaha</li></ul>
<button onclick="myFunction()">Remove Child</button>
<script>
var y = document.getElementsByTagName("ul")[0];
function myFunction(){
if(y.hasChildNodes())
y.removeChild(y.childNodes[0]);
else
alert("No child found in ul tag");
}
</script> </body>
</html>