Postcode Anywhere + addressfield

Public

When an addressfield is rebuilt (eg if country is changed), Postcode Anywhere breaks. This code forces it to be reloaded.

</> CopyGet raw version
javascript
  1. (function($) {
  2. Drupal.behaviors.pca = {
  3. attach: function (context, settings) {
  4. // reload capture plus on any DOM change, but ignore first load when context is entire doc
  5. if(typeof window.capturePlus != 'undefined' && ! (context instanceof HTMLDocument)) {
  6. // perform other DOM tweaks here if required
  7. window.capturePlus.load();
  8. }
  9. }};
  10. })(jQuery);