cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <section class="container">
  <h1>Гранулярные подсказки по адресу: обмен данными между полями</h1>
  <label for="region">Адрес одной строкой:</label><input id="address" name="address" type="text" />
  <br/><br/>
  <label for="region">Регион / район:</label><input id="region" name="region" type="text" />
  <br/><br/>
  <label for="city">Город / населенный пункт:</label><input id="city" name="city" type="text" />
  <br/><br/>
  <label for="street">Улица:</label><input id="street" name="street" type="text" />
  <br/><br/>
  <label for="house">Дом:</label><input id="house" name="house" type="text" />
  <br/><br/>
</section>

            
          
!
            
              .container {
  width: 30em;
}

input {
  font-size: 16px;
  padding: 4px;
}
            
          
!
            
              (function($) {
  
  var 
      token = "5ef98f5781a106962077fb18109095f9f11ebac1",
      type  = "ADDRESS",
      $address = $('#address'),
      $region = $("#region"),
      $city   = $("#city"),
      $street = $("#street"),
      $house  = $("#house");

  // адрес одной строкой 
  $address.suggestions({
    token: token,
    type: type,
    hint: false,
    onSelect: function (suggestion) {
      $region.suggestions('setSuggestion', suggestion);
      $city.suggestions('setSuggestion', suggestion);
      $street.suggestions('setSuggestion', suggestion);
      $house.suggestions('setSuggestion', suggestion);
    }
  });

  // регион и район
  $region.suggestions({
    token: token,
    type: type,
    hint: false,
    bounds: "region-area"
  });

  // город и населенный пункт
  $city.suggestions({
    token: token,
    type: type,
    hint: false,
    bounds: "city-settlement",
    constraints: $region
  });
  
  // улица
  $street.suggestions({
    token: token,
    type: type,
    hint: false,
    bounds: "street",
    constraints: $city
  });

  // дом
  $house.suggestions({
    token: token,
    type: type,
    hint: false,
    bounds: "house",
    constraints: $street,
    restrict_value: true // <--------------
  });
  
})(jQuery);


            
          
!
999px
Loading ..................

Console