0
結合
請這個簡單的代碼來說明情況:knockoutjs在運行時改變
<select id="se">
<option value="0">EN</option>
<option value="1">FR</option>
<option value="2">AR</option>
<option value="3">SP</option>
</select>
<input id="inp" data-bind='textInput: DESCRIPTION_FR' />
<script src="../Scripts/jquery-1.9.1.min.js"></script>
<script src="../Scripts/knockout-3.4.0.js"></script>
<script type="text/javascript">
var PRDVM = function() {
var self = this;
self.ID = ko.observable(0);
self.DESCRIPTION_FR = ko.observable('FR');
self.DESCRIPTION_EN = ko.observable('EN');
self.DESCRIPTION_AR = ko.observable('AR');
self.DESCRIPTION_SP = ko.observable('SP');
self.IMAGE = ko.observable('/images/noimage.png');
};
ko.applyBindings(new PRDVM());
</script>
我想是通過改變屬性在運行時輸入的結合,通過改變下拉列表切換語言選擇
任何關於如何做的想法都會很棒。
這裏出發小提琴 https://https://jsfiddle.net/smtsghqm/2/
感謝。