Slide 55
Slide 55 text
import $ from ‘jquery';
import Backbone from ‘backbone';
export default Backbone.View.extend({
el: 'form',
events: {
'keyup #note': 'resizeTextAreaField',
'blur #note': 'hideTextAreaCounters'
},
// Resize text area as user types
resizeTextAreaField: function (event) {
var count = this.countTextContent();
var newHeight = this.getIdealTextAreaHeight(count);
var newRows = this.getRowsFromHeight(newHeight);
$('#note').height(newHeight).attr('rows', newRows);
},
// Update textarea counter with remaining character left
hideTextAreaCounters: function (event) {
// pseudo code
},