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