1
我已經在初始化函數後插入了自動完成功能,如從stickit文檔中建議的那樣。stickit不保存來自自動填充字段的值
幾乎世界你好世界的例子:
MyApp.Views.Form = Backbone.View.extend({ el: "#my-form", bindings: { "#postcode_with_suburbs": { observe: "postcode", initialize: function($el, model, options) { $el.autocomplete({ source: [ "c++", "java", "php", "coldfusion", "javascript", "asp", "ruby" ] }) }, onSet: function(val, options) { return $("#postcode_with_suburbs").val(); } }, }, events: { "click #form-submit" : "submit", }, initialize : function() { this.listenTo(this.model, "change"); this.render(); }, render: function() { this.$el.html(JST['backbone/templates/car_insurance/form']); this.stickit(); return this; } });
所以問題是,每當用戶填寫表單並通過autocomletes的點擊郵編它不會保存到模型屬性的自動完成值。的Saved as ja
代替java
但是向下滾動帶鍵盤在從自動完成選項,該值已正確設置爲模型的屬性。 Saved as java
這些元素很難迴應。我們看不到html標記。你能提供一個可以重現問題的jsfiddle嗎? – gentiane