Solved

onClick checkbox to show and hide a div area not working when div content is large

Posted on 2009-06-30
3
428 Views
Last Modified: 2013-11-24
I been Following the question  http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_21395578.html and implemented the code in struts2 jsp page.
But the code seems to be not working ..

the div contents will be generated on the fly

Please somebody help
code is as follows
 

<script>

function comm_direct_change(checked){

     document.getElementById('direct').style.display = checked?"block":"none";

}

</script>
 

  <s:checkbox label="Symptoms" name="check1" onclick="comm_direct_change(this.checked)" />

                          <div id="sym" style="display: none;" >    <display:column property="symptoms" title="Symptoms" sortable="true" maxLength="40" style="font-family: Arial;width:100px"/>  </div>

Open in new window

0
Comment
Question by:pothireddysunil
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
Comment Utility
Hi pothireddysunil,
>>..But the code seems to be not working ..
Do you refer correct control's ID? Should refer "sym" instead of "direct" based on the existing code here.
eg:

function comm_direct_change(checked){
     document.getElementById('sym').style.display = checked?"block":"none";
}
0
 
LVL 1

Author Comment

by:pothireddysunil
Comment Utility
sorry ,i have the correct Id specified...but still does'nt work.
Is there any size limit condidered for this.Also i'm trying on jsp ...will it be different.I ran some samples in html they work fine...but i fail when i run this with jsp in the above case
0
 
LVL 29

Expert Comment

by:David H.H.Lee
Comment Utility
Hi pothireddysunil,
>>..but still does'nt work.
Any error return?

>>..Is there any size limit condidered for this.
what is the size limit that you're referring here? Do you meant the <Div>'s content?

>>..I ran some samples in html they work fine...but i fail when i run this with jsp in the above case
I'm not really familiar with JSP. Probably some other event is stopping that hiding <Div> behavior on your existing flow?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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…

772 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

10 Experts available now in Live!

Get 1:1 Help Now