We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Cant hide first div

Waponi
Waponi asked
on
Medium Priority
468 Views
Last Modified: 2012-05-11
Hello,
I have a javascript function which hides  a <div> containing forms, tables, text, etc by passing in the id of the div.(For test purposes only)
The function works for all the div(s) except the very first.
Any suggestions why this would be the case ?
Thanks.
//jsp side
<tr><td><button  onclick="toggle();"><u>H</u>ide</button>                
<c:forEach items="${jobList.jobList}" var="job" varStatus="status">
 <div id="divId_${job.jobId}">
 <c:set var="formId" value="formId_${job.jobId}" />
 form:form name="jobForm" id ="${formId}" method="POST" action="jobmenu.htm"     commandName="job">
     :
     :
</div>

//javascript
  function toggle()
    {
   var ID;
   ID= prompt("Enter id \n\r");
    var a = document.getElementById('divId_'+ID);
    if (a.style.display=="inline")
    {
    a.style.display="none";
    }
    else if (a.style.display=="none")
    {
    a.style.display="inline";
    }
    else
    {
    a.style.display="block";
    a.style.display="none";
    }
    return false;
    }
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
IT Expert
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks,
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
Great

Please note a typo I had
else disp=="none";
should be
else disp="none";
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.