Home >Web Front-end >JS Tutorial >How to select an image in rich text and insert it into the editor (with code)
The content of this article is about how to select an img to insert into the editor in rich text (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
I am calling a popup layer on the editor, and after requesting the image data, how can I insert the selected image into the editor
Click on the picture to get the one in the picture li
//监听li点击事件 $("#yun").on("click",'li',function(e){ var alt=e.target.alt callback && callback({ src: img ,alt: alt }); //关闭云盘 layer.close(index); })
Print console.log(ehtml) to get the following structure
<img src="//www.×××.cn/upload/company/banner/201806302108090467.jpg" alt="201806302108090467.jpg">
I want to insert this into the picture to make it as convenient as inserting an expression. Click anywhere in the editor to insert this image.
Related recommendations:
Use the rich text editor to upload the image pop-up layer code implementation
How to delete the table using javascript Checked line (code)
The above is the detailed content of How to select an image in rich text and insert it into the editor (with code). For more information, please follow other related articles on the PHP Chinese website!