public
Description: JavaScript wrapper to automatically fill form fields with geo information either by IP or Postcode
Homepage: http://icant.co.uk/geofill/
Clone URL: git://github.com/codepo8/JavaScript-Geo-Fill.git
JavaScript-Geo-Fill / addbutton.js
100644 19 lines (18 sloc) 0.484 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(function(){
  var addto = document.getElementById('address');
  var but = document.createElement('input');
  but.setAttribute('type','button');
  but.setAttribute('value','Find Location');
  but.onclick = function(){
    geofill.find(
      {
        'city':'usercity',
        'latitude':'userlat',
        'longitude':'userlon',
        'postcode':'userpostcode',
        'country':'usercountry'
      }
    );
  }
  addto.parentNode.insertBefore(but,addto.nextSibling);
})();