[program-l] show/hide div area with java script help

  • From: "Bryan Schulz" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "b.schulz" for DMARC)
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Sat, 17 Apr 2021 13:43:17 -0500

hi guys,

 

I'm still hung up on showing/hiding div areas.

I want a check in the unlisted checkbox to hide the phone number boxes.

Could someone see what is wrong with this code?

 

java script code:

function showPhones() {

                if (document.getElementById('chkUnlisted').checked) {

 
document.getElementById('phoneBoxes').style.display = 'none';

                } else {

 
document.getElementById('phoneBoxes').style.display = 'block';

                } //end document.getElementById if

} //end showPhones function

 

html checkbox:

<tr><td> <input type="checkbox" id="chkUnlisted" name="chkUnlisted" value=""
tabindex="1" onclick="showPhones();"> </td>

<td colspan="2"> <label for="chkUnlisted">My phone number is unlisted!
</label></td></tr>

 

html div area with phone textboxes:

<div id="phoneBoxes" style="display: block;">

<tr><td><label for="phone">Phone: </label></td><td> (<input type="text"
id="phone" name="phone1" value="" size="3" maxlength="3" tabindex="1">) 

<input type="text" id="phone" name="phone2" value="" size="3" maxlength="3"
tabindex="1"> - <input type="text" id="phone" name="phone3" value=""
size="4" maxlength="4" tabindex="1"> </td><td> </td><td> </td></tr>

</div>

 

thanks,

Bryan

 



-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Other related posts: