JSFiddle - React, Tailwind, and code Playground

by lforms

HTML

<html>
  <head><link rel=stylesheet href="https://clin-table-search.lhc.nlm.nih.gov/autocomplete-lhc-versions/15.1.1/autocomplete-lhc.min.css"></head>
  <body>
    <p><input type="text" id="npi_idv" placeholder="Provider name or NPI"></p>
    <p><input type="text" id="address" readonly placeholder="Address"></p>
        
    <script src="https://clin-table-search.lhc.nlm.nih.gov/autocomplete-lhc-versions/15.1.1/autocomplete-lhc_jQuery.min.js"></script>
  </body>
</html>

JavaScript

var autocomp = new Def.Autocompleter.Search('npi_idv',
  'https://clin-table-search.lhc.nlm.nih.gov/api/npi_idv/v3/search?df=name.full,NPI&ef=addr_practice.full',
  {tableFormat: true, colHeaders: ['Name', 'NPI']
  });
  
Def.Autocompleter.Event.observeListSelections('npi_idv', function() {
  var itemData = autocomp.getSelectedItemData()[0].data;
  var field = $('#address')[0];
  field.value = itemData['addr_practice.full'];
});