这是HTML:
<button class='ekit_action' data-action='send'>Send</button>
<button class='ekit_action' data-action='view'>View</button>
<button class='ekit_action' data-action='edit'>Edit</button>
<button class='ekit_action' data-action='delete'>Delete</button>
这是javscript:
`
$(function() {
$(".ekit_action").click(function(e) {
e.preventDefault();
ekits_actions.init(this);
});
var ekits_actions = {
init: function(button) {
var action = button.dataset.action;
if(!action) {
return CreateMessage("alertErrorMessage", "Program Error: Can not determine Action");
}
return this.action();
},
send: function() {
alert("send");
},
view: function() {
alert("view");
},
edit: function() {
alert("edit");
},
delete: function() {
alert("delete");
}
}
});
`
当我调用return this.action();我得到Uncaught TypeError:undefined不是函数
这是不可能的还是我应该做别的事?