Solved

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

Posted on 2009-06-30
3
430 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
ID: 24751623
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
ID: 24753981
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
ID: 24759895
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web application structure 18 77
Using jQuery to set a DIV attribute on page load 9 32
Google Maps API and PHP 25 32
Javascript Form Change 5 23
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 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)

810 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