Not a constructor error within jQuery.on -


given following code:

var test; this.test = function() { //... };  $(document).ready(function() { $(this).on('click', function(e) { test = new test(); //... 

i test not constructor. why?

@edit: constructor , adding variable test type:

function test(){     this.something = 'hello'; }  $(document).ready(function() {     $(this).on('click', function(e) {      var test = new test();      alert(test.something);     }); 

});

this result in alert 'hello' text. adapting code, can do:

var test = {     something: "hello" };  $(document).ready(function() {     $(this).on('click', function(e) {      var test = new object();      alert(test.something);     }); }); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -