0
var viewModel = function (utils) {
this.x="GNC";
this.tbl = null; }; viewModel.prototype.saveCords=function(){ alerts(this.x); };
$(function(){
var objViewModel=new viewModel();
$('#btnSaveCords').on('click',objViewModel.saveCords); // this is suppose to alert "GNC", but it doesnt
});
那麼,如何獲取saveCords中的對象上下文而不是按鈕上下文?如何在本例中獲取對象上下文?