I want to get the values from handsontable but i am getting this error: Uncaught ReferenceError: hot is not defined
I don't know why i am getting this error as i have defined hot .
here is my js code
<body>
<div id='table_set' style='margin-left:150px;'>
<button id='save'>Save</button>
<div class='handsontable' id='create_table'></div>
</div>
</body>
<script>
$(document).ready(function () {
var data = [[]];
var container = document.getElementById('create_table');
var hot = new Handsontable(container,
{
data: data,
minRows: 30,
minCols: 13,
maxRows:100,
copyPaste:true,
colHeaders: true,
rowHeaders: true,
rowHeaders: true,
contextMenu: true,
dropdown: true,
colHeaders:["Testcase Name","Cell Name","Customer","Flops","Title","Status","Mfix CCR(open/close)","Scenerio-Brief Description","Expected Results","CCR Status","CCR No.","Remarks","Testcase Path"]
});
});
$(document).ready(function () {
$('#save').click(function() {
var pr= hot.getData();
alert(pr);
});
});
I want to get the values i have written in the table , in the alert box whenever i hit the save button.Please help, where i am missing.
Thanks in advance.
Your error is probably multiple document.ready
function i think variable declared in one document.ready
cannot be accessed in other
generally dont use mulitple document.ready
you can achieve these with single document.ready
refer : Can you have multiple $(document).ready(function(){ ... }); sections?
handson table reference : http://jsfiddle.net/yk64yv8q/4/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.