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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -