Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="leftpanel">
- <div class="input-row" data-bind="foreach: inputItems">
- <div class="input-row-item">
- <div class="input-item">
- <label data-bind="text: label"></label>
- <input data-bind="attr:{ name: name, placeholder: placeholder, disabled: disabled, value: value, type: type }">
- </div>
- <div class="input-settings">
- <input type="text" class="nb-remove" data-bind="value: label" placeholder="input label">
- <input type="text" value="text" class="nb-remove" data-bind="value: type" placeholder="input type">
- <input type="text" class="nb-remove" data-bind="value: name" placeholder="input name">
- <input type="text" class="nb-remove" data-bind="value: placeholder" placeholder="input placeholder">
- <input type="text" class="nb-remove" data-bind="value: disabled" placeholder="input disabled">
- <input type="text" class="nb-remove" data-bind="value: value" placeholder="input value">
- </div>
- </div>
- </div>
- </div>
- <div class="rightpanel">
- Here be draggables!
- <br/>
- <button data-bind="click: addInput">ADD TEXT INPUT</button>
- </div>
- $(function(){
- var InputItem = function InputItem(label, type, name, placeholder, disabled, value) {
- this.label = ko.observable(label);
- this.type = ko.observable(type);
- this.name = ko.observable(name);
- this.placeholder = ko.observable(placeholder);
- this.disabled = ko.observable(disabled);
- this.value = ko.observable(value);
- }
- var ViewModel = function ViewModel() {
- var that = this;
- this.inputItems = ko.observableArray([]);
- this.addInput = function addInput() {
- that.inputItems.push(new InputItem());
- };
- }
- ko.applyBindings(new ViewModel());
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement