Search code examples
c#jqueryhandsontable

How to get Handsontable data on html button click


I want to get handsontable data on button click. for this, I'm calling the buttonSave function. But on var JSON I'm getting an error as $container.data is not a function. Where I'm doing wrong?

Code is as below:

function buttonSave() {
    var $container = document.getElementById("divadhoc");
    var json = $container.data('handsontable').getData();
}

Solution

  • data is a jquery function but container is no jquery object. Use $('#divadhoc') to create the jquery object.