faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 27 people (37%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

how can remove element in dropdown list using java script

Apr 8th, 2008 18:04
ha mo, Jeff Papineau, Ankur Patel,


<SCRIPT LANGUAGE="JavaScript">

function removeLastOption() {
   var pulld = document.form1.pulldown;
   var leng = pulld.options.length;
   pulld.options[leng-1] = null;
}

</SCRIPT>

<form name="form1">
    <select name="pulldown">
        <option value="">choose one...
        <option value="2">Mick
        <option value="37">Sean
        <option value="9">Chris
        <option value="1">Mark
    </select>
    <button onClick="removeLastOption()"> Remove Last Option </button>
</form>



http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com