Last active
December 20, 2015 12:09
-
-
Save arsisakarn/6128411 to your computer and use it in GitHub Desktop.
jeditable textarea handle \n <br>
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
$(document).ready(function() { | |
$('.edit_area').editable('/th/ipad/memo-update', { | |
type: 'textarea', | |
cancel: 'Cancel', | |
submit: 'Save', | |
indicator: 'Saving...', | |
tooltip: 'Click to edit...', | |
style: 'inherit', | |
cssclass: 'editable', | |
callback: function(value,settings) { | |
var retval = value.replace(/\n/gi, "<br>\n"); | |
$(this).html(retval); | |
}, | |
data: function(value,settings) { | |
value = value.replace(/\r/gi, ""); | |
value = value.replace(/\n/gi, ""); | |
var retval = value.replace(/<br>/gi, "\n"); | |
return retval; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice... save my hours