Created
January 8, 2019 05:33
-
-
Save luc4leone/55862332e257e6c41fa1922bbcf4dbfb to your computer and use it in GitHub Desktop.
Todo mvc js edit method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edit: function (event) { | |
var labelEl = event.target; | |
var liEl = labelEl.closest('li'); | |
var inputEl = liEl.lastElementChild; | |
var len = inputEl.value.length; | |
liEl.className = 'editing'; | |
inputEl.focus(); | |
inputEl.setSelectionRange(len, len); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment