Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1729
  • 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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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