Expert JavaScript Developer Question:
Download Questions PDF

How to write a script for "Select" lists using JavaScript?

Expert JavaScript Developer Interview Question
Expert JavaScript Developer Interview Question

Answer:

1. To remove an item from a list set it to null
mySelectObject.options[3] = null
2. To truncate a list set its length to the maximum size you desire
mySelectObject.length = 2
3. To delete all options in a select object set the length to 0.
mySelectObject.leng

Download Expert JavaScript Developer Interview Questions And Answers PDF

Previous QuestionNext Question
How you can embed JavaScript in a web page?What does "1"+2+4 evaluate to?