remove() function not working in javascript -


I have the html selection box and a search field (input type)

when I search for something The new, javascript function first clears the selectfield.

But JavaScript returns the following error:

The gs.options.remove function is not

This function is < / P> function blank (theft) (for {var i = gs.options.length; i & gt; = 0; i--) {gs.options.remove (i); }}

and gs =

  & lt; Select value style = "width: 420px; height: 150px;" Name = "selection box" size = "5" & gt;  

What's going wrong?

I think there is no selection box reference in your example "GS".

All options are being removed

  Remove the functionAlloption (selection box) {var i; (I = selectbox.options.length-1; i> = 0; i--) {selectbox.remove (i); }}  

Removing selected option

  Delete function option (selection box) {var i; (I = selectbox.options.length-1; i> = 0; i--) {if (selectbox.options [i] .selected) selectbox.remove (i); }}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -