0

Im using

document.write("Your IP is :", userip)

To output IP that I targets for a specific use - I need to hide this string in the dom. I tried this and It shows in a span in the dom but not fully working:

document.write("<span>\Your IP is :\, userip</span>");

If I tried to add a class to it it didn't work at all.

How Do I hide it, but keeping it in the DOM?

Xeptor
  • 467
  • 5
  • 18

1 Answers1

2

You could do this as follows:

document.write('<span style="display:none">Your IP is :' + userip + '</span>');

But consider not using document.write at all, and using DOM methods to insert content once the document is loaded.

Community
  • 1
  • 1
trincot
  • 317,000
  • 35
  • 244
  • 286