Bootstrap按钮单击事件不起作用 [英] Bootstrap button click event not working

查看:1348
本文介绍了Bootstrap按钮单击事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正根据数据动态生成按钮。我还必须动态分配data-name属性。动态按钮生成正常。



但如果我想在这些按钮上添加一个click(knockout js)事件,它会在运行时返回一个错误,表示敲除功能未定义。 />






这是我的观点



define(['services / logger','durandal / system'],

函数(logger,system,staffheader){

var title ='Staff Review';



var StaffReviewRequestObject = ko.observable();



var vm = {

激活:激活,

StaffReview:ko.observable(),

ReviewCode:ko.observableArray(),

loadViewModel:ko。 observable(),

buttonLoadModel:buttonLoadModel

};



return vm;



功能激活(){

返回true;

}

});



任何建议,为什么运行时找不到点击事件buttonLoadModel???

解决方案

data.code} class =btn btn-primary> < / button>









这是我的观点



define(['services / logger','durandal / system '],

功能(记录器,系统,员工头){

var title ='员工评价';



var StaffReviewRequestObject = ko.observable();



var vm = {

激活:激活,

StaffReview:ko.observable(),

ReviewCode:ko.observableArray(),

loadViewModel:ko.observable(),

buttonLoadModel:buttonLoadModel

};



返回vm;



函数activate(){

返回true;

}

});



任何建议,为什么运行时找不到点击事件buttonLoadModel???

I am generating buttons dynamically based on the data. I have to assign the data-name attribute dynamically as well. The dynamic buttons generation is working properly.

but if i want to add a click (knockout js) event to these buttons, it returns an error at the run time that the knockout function is undefined.



here is my view

define(['services/logger', 'durandal/system'],
function (logger, system, staffheader) {
var title = 'Staff Review';

var StaffReviewRequestObject = ko.observable();

var vm = {
activate: activate,
StaffReview: ko.observable(),
ReviewCode : ko.observableArray(),
loadViewModel: ko.observable(),
buttonLoadModel: buttonLoadModel
};

return vm;

function activate() {
return true;
}
});

any suggestions, why the runtime cannot find the click event "buttonLoadModel" ???

解决方案

data.code }" class="btn btn-primary"></button>





here is my view

define(['services/logger', 'durandal/system'],
function (logger, system, staffheader) {
var title = 'Staff Review';

var StaffReviewRequestObject = ko.observable();

var vm = {
activate: activate,
StaffReview: ko.observable(),
ReviewCode : ko.observableArray(),
loadViewModel: ko.observable(),
buttonLoadModel: buttonLoadModel
};

return vm;

function activate() {
return true;
}
});

any suggestions, why the runtime cannot find the click event "buttonLoadModel" ???


这篇关于Bootstrap按钮单击事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发语言最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆