开发者

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);
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜