using onClick() on a html button

I am a beginner on JavaScript. I am trying to make a button that takes you to a specific location. i have 4 buttons each with different location to pick from. i want to be able to click on it and show the location on my map that i have on my website as well.

function moveMap(){
  var map = new mapboxgl.Map (document.getElementById('map'), {
    center:{lat:51.452011, lng:-2.635600},
    zoom:12
  })
}
<li onclick="moveMap()">
  <img src="image/.jpg">
  <h3>Palace</h3>
  <p>Lorem ipsum dolor sit amet</p>
</li>
<li>
  <div class="map1">
    <div id='map' ></div>
  </div>