javascript - Parameter in a jquery event -


i want pass object called hottraitement in parameters of event .click of jquery. declare object :

$(window).load(function(){         container = document.getelementbyid('tab_traitement');         var hottraitement = new handsontable(container, {             data: data_traitement}); }); 

and i'm trying pass object :

$('#submit_button_traitement').click(function({hottraitement:hottraitement}) {     console.log(hottraitement); }); 

but it's not working, hottraitement undefined.

help please !

try this. define hottraitement variable global one.

$('#submit_button_traitement').click({hottraitement:hottraitement},function(e){    console.log(e.data.hottraitement); }); 

simple demo: fiddle

update:

try way.

$(document).ready(function() {    var container = document.getelementbyid('tab_traitement');    var hottraitement = new handsontable(container, {      data: data_traitement    });      //...      $('#submit_button_traitement').click({      hottraitement: hottraitement    }, function(e) {      console.log(e.data.hottraitement);    });    });


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -