Clear Listbox and Enable/Disable Button

Posted on 2005-04-22
Last Modified: 2012-05-05


Please see my previous questions here:
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()

Thanks! msyed1.
Question by:msyed1
    LVL 32

    Accepted Solution

    You clear a select box by setting the length attribute to 0



    to clear this select box

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

    and you can disable a button by setting the disabled attribute


    <input type="button" id="buttonID" value="OK">

    Author Comment

    Batalf: It works! Thank you much...msyed1.
    LVL 32

    Expert Comment

    Glad I could help!


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    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)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now