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
  • 447
  • 4
  • 17

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
  • 211,288
  • 25
  • 175
  • 211