Skip to content
Advertisement

Java script change clipboard notes

I have script that copy ID internal content to user clipboard (style CTRL+C)

IF the URL contain & and the script change it to &.

How can i prevent it? i would like it to still be ‘&’ and not &

Thanks

HTML

JavaScript

SCRIPT

JavaScript

Advertisement

Answer

You can’t, and don’t need to. & is how HTML represents a & character.

If you want an HTML representation of some data, then you need &.

If you don’t want an HTML representation of some data, then don’t use innerHTML in the first place. Use textContent to get a text representation instead.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement