Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. <div class="leftpanel">
  2. <div class="input-row" data-bind="foreach: inputItems">
  3. <div class="input-row-item">
  4. <div class="input-item">
  5. <label data-bind="text: label"></label>
  6. <input data-bind="attr:{ name: name, placeholder: placeholder, disabled: disabled, value: value, type: type }">
  7. </div>
  8. <div class="input-settings">
  9. <input type="text" class="nb-remove" data-bind="value: label" placeholder="input label">
  10. <input type="text" value="text" class="nb-remove" data-bind="value: type" placeholder="input type">
  11. <input type="text" class="nb-remove" data-bind="value: name" placeholder="input name">
  12. <input type="text" class="nb-remove" data-bind="value: placeholder" placeholder="input placeholder">
  13. <input type="text" class="nb-remove" data-bind="value: disabled" placeholder="input disabled">
  14. <input type="text" class="nb-remove" data-bind="value: value" placeholder="input value">
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="rightpanel">
  20. Here be draggables!
  21. <br/>
  22. <button data-bind="click: addInput">ADD TEXT INPUT</button>
  23. </div>
  24.  
  25. $(function(){
  26. var InputItem = function InputItem(label, type, name, placeholder, disabled, value) {
  27. this.label = ko.observable(label);
  28. this.type = ko.observable(type);
  29. this.name = ko.observable(name);
  30. this.placeholder = ko.observable(placeholder);
  31. this.disabled = ko.observable(disabled);
  32. this.value = ko.observable(value);
  33. }
  34.  
  35. var ViewModel = function ViewModel() {
  36. var that = this;
  37.  
  38. this.inputItems = ko.observableArray([]);
  39.  
  40. this.addInput = function addInput() {
  41. that.inputItems.push(new InputItem());
  42. };
  43.  
  44. }
  45.  
  46. ko.applyBindings(new ViewModel());
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement