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
Post a Comment