Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:19:09+00:00 2026-06-05T19:19:09+00:00

I have a variable when i write its value using document.write() i don’t get

  • 0

I have a variable when i write its value using document.write() i don’t get the true value. See this-

 <div onclick="a=this;document.write(a)">this is div</div>

With this by clicking div i get this[object HTMLDivElement]. But this not the true value see how-

 <button onclick="[object HTMLDivElement].style.visibility='hidden'">click me</button>

when i used this code. I expected that it will hide all div elements. But i didn’t got that. Why?

Note:-

i don’t want a better way to do this, i want to know the problem in my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:19:10+00:00Added an answer on June 5, 2026 at 7:19 pm

    Passing an object to document.write will convert the object to a string by calling .toString().

    When called on a <div> DOM element, toString() returns "[object HTMLDivElement]".

    This is just a string representation of the object; it is fundamentally impossible to retrieve the original object from that string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GUID variable and I want to write inside a text file
Suppose I have a text variable $$string . How can I write a boolean
in SQL Server, if I have an int variable, how can I write a
If I have a Store class, I can write Store starbucks; Here, the variable
I have this small PHP script that takes a POST variable and writes it
I have variable @count of datatype int.I am setting values to this @count. I
In a PowerShell script, how does one get the value of an environment variable
I have variable on my JS qty , the type is string. How to
i have variable $lang which convert string to the selected language but i am
Hello everybody i have variable(widthPercent) where i store percent for example: 67.33% when i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.