本文介绍了如何使此表单获取用户的输入并再次呈现它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<html>
<head>
<meta charset="UTF-8">
<script src="jquery.js"></script>
<script src="underscore.js" type="text/javascript"></script>
<script src="backbone.js" type="text/javascript"></script>
<script type="text/template" id="name">
<form method="Post">Name:
<input type="text" name="name" id="input" />
<input type="submit" value="submit" id="form-submit" />
</form>
</script>
<title>Form8</title>
</head>
<body>
FormModel = Backbone.Model.extend({
defaults: {
name: ''
}
});
FormCollection = Backbone.Collection.extend({
model: FormModel
});
FormView = Backbone.View.extend({
el: '#View',
events: {
'click #form-submit': 'OnFormSubmit'
},
initialize: function () {
this.render();
},
OnFormSubmit: function () {
template1 = _.template($("#name").html());
},
render: function () {
$(this.el).html($("#name").html());
return this;
}
});
var FormView = new FormView();
</script>
推荐答案
这篇关于如何使此表单获取用户的输入并再次呈现它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!