Skip to content

Commit

Permalink
Fix demo input card for FF
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Nov 9, 2015
1 parent 1a66b0f commit f6563f8
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions demo/app/mobiledoc-cards/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,32 @@ export let inputCard = {
if (payload.name) {
text = 'Hello, ' + payload.name + '!';
}
var card = document.createElement('div');
card.innerText = text;

var button = document.createElement('button');
button.innerText = 'Edit';
button.onclick = env.edit;
var card = $(`<div>${text}</div>`);
var button = $('<button>Edit</button>');
button.on('click', env.edit);

if (env.edit) {
card.appendChild(button);
card.append(button);
}
element.appendChild(card);
$(element).append(card);
}
},
edit: {
setup(element, options, env) {
$(element).empty();
var card = document.createElement('div');
var card = $('<div>What is your name?</div>');
card.innerHTML = 'What is your name?';

var input = document.createElement('input');
input.placeholder = 'Enter your name...';

var button = document.createElement('button');
button.innerText = 'Save';
button.onclick = function() {
var name = input.value;
env.save({name:name});
};
var input = $('<input placeholder="Enter your name...">');
var button = $('<button>Save</button>');
button.on('click', () => {
var name = input.val();
env.save({name});
});

card.appendChild(input);
card.appendChild(button);
element.appendChild(card);
card.append(input);
card.append(button);
$(element).append(card);
}
}
};

0 comments on commit f6563f8

Please sign in to comment.