title: How to Apply multiple map layers on map using openlayers through checkbox?
body: <p>I wnat to show multiple layers on map thar has a baselayer showinn using openlayers when i click a check box. for example if i click a checkbox name Population and another checkbox name Income and sale the can show specific layer that i applied on my backend APi.</p>
  
  <p>I have tried this by using jquery . First i put the<code>enter code here</code> values of checkbox in a variable the i pass a change function for to checkboxes the code is below. the i pass the variable to the map object . but the map does not work it throws an error that Ol_uid not found.</p>
  
  <pre><code>var check = document.querySelectorAll('#main-side &gt; ul &gt; li &gt; ul &gt; li input[type=checkbox]')
  $(check).change(function () {
  
                  let checked = this.checked;
                  var test = new ol.layer.Image({
                      source: new ol.source.ImageWMS({
                          url: 'http://3.16.123.168:8080/geoserver/wms?',
                          params: {
                              'LAYERS': `twmp:${$(this).val()} `
                          },
                          ratio: 1,
                          serverType: 'geoserver',
                          crossOrigin: 'anonymous'
                      })
                  });
                  test.setVisible(checked);
  
                  console.log(test);
              });
  &lt;code&gt;
  var map = new ol.Map({
                  layers: [
                      new ol.layer.VectorTile({
                          declutter: true,
                          source: new ol.source.VectorTile({
                              attributions: '© &lt;a href="https://www.mapbox.com/map-feedback/"&gt;Mapbox&lt;/a&gt; ' +
                                  '© &lt;a href="https://www.openstreetmap.org/copyright"&gt;' +
                                  'OpenStreetMap contributors&lt;/a&gt;',
                              format: new ol.format.MVT(),
                              url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
                                  '{z}/{x}/{y}.vector.pbf?access_token=' + key
                          }),
                          style: createMapboxStreetsV6Style(ol.style.Style, ol.style.Fill, ol
                              .style.Stroke, ol
                              .style.Icon, ol.style.Text)
                      }),
                      test
                  ],
                  target: 'map',
                  view: view
              });
  </code></pre>
  
  <p></p>
  
  <p>I expect to pass the value of checkbox to the variable</p>