Solved

could not get visibility property

Posted on 2006-11-18
6
1,154 Views
Last Modified: 2008-01-09
hi, I have set of divs:  
<div id=$i'  style='visibility:collapse' ></div> and:

function show_comment(param) {
      if(window.prev_tag)  prev_tag.innerHTML = ' ';

      document.getElementById(paramt).innerHTML = 'some_txt';      
      window.prev_tag = document.getElementById(param);
}

the problem: when  I click another link  the previous div became empty as expected BUT doest collapse.

is there a way to force the div to return to its initial style'  ie :  <div id=$i'  style='visibility:collapse' ></div>



0
Comment
Question by:uk1900
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:jay_gadhavi
Comment Utility
u can use : this.style.visibility='hidden' for hiding the div or this.style.visibility=' ' for visible the div.

Like example

<a style="color:black;" href="javascript:void(0);"
onclick="this.style.visibility='hidden';">
Click on me, monkey.
</a>

I think it may solved your proble,
Regards,
jay


0
 

Author Comment

by:uk1900
Comment Utility
thx jay_gadhavi

yes it hides the div but doesnt collapse.

if u click now u still have an empty line between AAAA and BBBB.
-----------------
AAAA
<div style="color:black;" href="javascript:void(0);"
onclick="this.style.visibility='hidden';">
Click on me, monkey.
</div>
BBBBB
-----------------------
0
 
LVL 41

Accepted Solution

by:
HonorGod earned 500 total points
Comment Utility
the visibility tells the browser to keep the item space there.  If you want to have div collapsed, you need to use:

  style="display:none"
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 41

Expert Comment

by:HonorGod
Comment Utility
0
 

Author Comment

by:uk1900
Comment Utility
thx HonorGod  it works.
0
 
LVL 41

Expert Comment

by:HonorGod
Comment Utility
Great.  Thanks for the 'A'.  Good luck
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now