How to make onchange event in Polymer

Asked By: Anonymous

I’m getting this message TypeError: document.addEventListener(…) is not a function

(document.addEventListener('polymer-ready',function($){
 console.log('ready')
   // top link
   $.each(decodeURI(location.pathname).split('/'), function() {
      $("#self").html(this+'');
   });

   // browser default lang
   default_lang = navigator.language /* Mozilla */ || navigator.userLanguage /* IE */;

   // does URL contain lang=xx ?
   $.each(decodeURI(location.search.substr(1)).split('&'), function() {
     var s = this.split('=');
     if (s[0]=="lang") default_lang = s[1];
   });

   // toplevel = earth
   $("#earth").click(
     function(e) {
        e.preventDefault();
        //location.href = "http://www.geonames.org";
     }
  );

  // entry point
  geo_click($("#earth"));
}))(jQuery);

Can someone tell me what is wrong with that?


Solution

Answered By: Anonymous

Problem Solved!

function geoready(){
console.log('ready');
// top link
$.each(decodeURI(location.pathname).split('/'), function() {
  $("#self").html(this+'');
});

// browser default lang
default_lang = navigator.language /* Mozilla */ || navigator.userLanguage /* IE */;

// does URL contain lang=xx ?
$.each(decodeURI(location.search.substr(1)).split('&'), function() {
    var s = this.split('=');
    if (s[0]=="lang") default_lang = s[1];
});

// toplevel = earth
$("#earth").click(
    function(e) {
        e.preventDefault();
        //location.href = "http://www.geonames.org";
    }
);

// entry point
geo_click($("#earth"));
}

And I bind that in the Polymer constructor:

 <script>
    Polymer({
        is: "geo-dropdown",
        ready: geoready
    });
</script>
techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno