<div class="font-sans antialiased w-screen">
  <div class="w-screen flex flex-col space-x-0 h-screen">
    <div class="flex-1 min-w-full p-4">
      <h3 class="text-xl font-semibold">Update an iframe src to load specific map features in Mango</h3>
      <ol class="text-base p-4">
        <li>Select a state from the dropdown list
        <li>click "Update map" to update the permalink used as the iframe src using jQuery.
      <p class="text-sm p-4">Switch to the JS view to see how this works</p>
        <label class="text-base font-semibold" for="id">Choose a state:</label>
        <select name="features" id="id" class="border px-1 py-1 rounded-lg">
          <option value="" selected disabled>Please select...</option>
          <option value="63">Florida</option>
          <option value="68">Kentucky</option>
          <option value="2">Montana</option>
          <option value="37">Washington</option>
        <input type="button" class="transition duration-300 ease-in-out px-4 py-1 rounded-lg bg-green-400 cursor-pointer hover:bg-green-700 hover:text-white" value="Update map" onClick="newSite()" />
    <div class="mx-none flex-1 flex-grow">
      <iframe id="iframe" class="h-screen lg:w-screen md:w-screen sm:min-w-full"  src="https://mangomap.com/examples/maps/51841/category-map"></iframe>
// Inserts the value from the state selection input into the iframe.src
// gid is an internal Mango id, but you can use any unique field=value pair.
// For example, field=state&value=Kentucky

function newSite() {
  var fid = $("#id").val();
  var newURL =
    "https://mangomap.com/examples/maps/51841/category-map?layer=c02f3720-15d4-11e6-86d6-06c182e4d011&field=gid&value=" +
  var iframe = document.getElementById("iframe");
  iframe.src = newURL;
  iframe.src = iframe.src;
Run Pen

External CSS

  1. https://fonts.googleapis.com/css2?family=Inter:wght@400;900&amp;display=swap
  2. https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.1.2/tailwind.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/twind/0.16.13/twind.js