I want to attach keypress
and focusout
event handlers to a paragraph inside contenteditable div
.
The following code doesn't seem to work:
<div contenteditable="true">
<p id="p1">Test</p>
<p id="p2">Test</p>
<p id="p3">Test</p>
</div>
$('#p1').bind('keypress', function(e) {
alert('keypress');
});
$('#p1').focusout(function(e) {
alert('focusout');
});
`. This is all about formulation of your question.