We would like to know how to get text value from Contenteditable div.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.7.1.js'></script>
<style type='text/css'>
div#foo {<!--from ww w. ja v a2 s. c o m-->
text-transform: uppercase;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
$('#foo').on('blur', function() {
$('#log').empty().append($(this).html());
});
});
</script>
</head>
<body>
<div id="foo" contenteditable>foo</div>
<div id="log"></div>
</body>
</html>
The code above is rendered as follows: