Remove closing slash '/' from image tag in XHTML
P粉520545753
P粉520545753 2023-09-06 12:15:38
0
1
634

I have a string txt1 that stores an image. Its value is in XHTML format, that is, the element is closed: Happyface. But I need to remove that closing slash so it can be Happyface just like in HTML5.

Is there a way to do this.

P粉520545753
P粉520545753

reply all(1)
P粉447002127

const txt1 = '<img src="happy.gif" alt="Happy face" />'.replace('/>', '>');
console.log(txt1)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template