• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1733
  • Last Modified:

Clear Listbox and Enable/Disable Button


Hello,

Please see my previous questions here: http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21390251.html 
In addition to the textboxes and labels, I also need to clear out the items within a Listbox and disable some of the buttons on the page.

The function I am currently using looks like this.  I need to add the clearing out of a listbox that is on the same page and also need to disable a few buttons:

function ClearText()
               {
                  document.getElementById('tbxSecurityNumber').value='';  
                  document.getElementById('lblSecurityGroup').innerHTML='';
                  document.getElementById('lblFirstName').innerHTML='';
                  document.getElementById('lblLastName').innerHTML='';
                  document.getElementById('tbxFormNumber').value='';
           }

Thanks! msyed1.
0
msyed1
Asked:
msyed1
  • 2
1 Solution
 
BatalfCommented:
You clear a select box by setting the length attribute to 0

example:

document.getElementById('selectBoxID').options.length=0;

to clear this select box

<select id="selectBoxID">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>

and you can disable a button by setting the disabled attribute

document.getElementById('buttonID').setAttribute('disabled',true);

<input type="button" id="buttonID" value="OK">
0
 
msyed1Author Commented:
Batalf: It works! Thank you much...msyed1.
0
 
BatalfCommented:
Glad I could help!

Batalf
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now