how to add div tags to content on enter key instead of p tags
On enter key press in a conten开发者_运维知识库teditable
iframe, <P>
tags are appended. I want to stop appending that <P>
tags and append <div>
tags instead.
Any suggestions will be valuable
Put some Keyup event and replace it
$('.myEditable').keyup(function(){
var sanitazed = $(this).text().replace(/<p[^<]*?>/g, '<div>').replace(/<\/p[^<]*?>/g, '</div>');
$(this).text(sanitazed);
});
精彩评论