【发布时间】:2017-02-07 18:57:46
【问题描述】:
我正在使用带有 ASP.NET MVC 的淘汰赛 js。当用户在下拉列表中选择后将鼠标悬停在所选值上时,我想在标题上显示所选值的文本。因此,如果隐藏的更大价值可以显示在标题中。 比如:如果我有三个值 One, Two , BiggerValuethathidden。
所以现在很明显,如果我的下拉列表大小不像第三个值那么大,我的第三个值将在为下拉列表定义的大小之后隐藏。所以我想在悬停时将值设置为标题时显示。
现在我尝试像这样实现下拉列表绑定:
<select class="form-control" data-bind="options: Accounts, optionsCaption: ' -- ', optionsText: function (item) { return item.AccountName }, optionsValue: function (item) { return item.Id }, value:AccountId, click: setTitle" required="required" data-parsley-required-message="Account is required" id="ddlAccounts">
要设置这么多搜索后,我想这样做:
<div title="" id=dvAccount">
<select class="form-control" data-bind="options: Accounts, optionsCaption: ' -- ', optionsText: function (item) { return item.AccountName }, optionsValue: function (item) { return item.Id }, value:AccountId, click: setTitle" required="required" data-parsley-required-message="Account is required" id="ddlAccounts">
</div>
基于Solution的点击事件函数:
setTip = function(c, event){
var element = event.currentTarget;
var qref = element.getAttribute('Qref');
var click_id = element.id;
return true;
}
我哪里出错了?
请有人帮我做这个棘手的把戏!
【问题讨论】:
标签: javascript jquery knockout.js title knockout-mvc