Solved

could not get visibility property

Posted on 2006-11-18
6
1,156 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
ID: 17971168
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
ID: 17971202
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
ID: 17971265
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 41

Expert Comment

by:HonorGod
ID: 17971266
0
 

Author Comment

by:uk1900
ID: 17971372
thx HonorGod  it works.
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 17978913
Great.  Thanks for the 'A'.  Good luck
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

786 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