Reputation: 3526
Enter in the Contenteditable "div" tag makes it creates a new "div" tag. How can I do so that it instead creates a "p", if you hit enter after an "img" tag?
<div id="append_id" contenteditable="true">
This text can be edited by the user.
<img style="height:100px;" src="myImage.jpg" />
</div>
Upvotes: 1
Views: 569
Reputation: 494
The default paragraph can be specified in chrome by using:
document.execCommand('defaultParagraphSeparator', false, 'p')
See how to change behavior of contenteditable blocks after on enter pressed in various browsers.
Upvotes: 2