Your Ad Here

Posted By

indianocean on 11/30/07


Tagged

javascript html


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


Delete item from HTML option list


 / Published in: JavaScript
 

  1. var optValue = 3; // value of the item to delete
  2. var myOptionList = document.getElementById("myList");
  3. var theposition= '';
  4. for(var i=0;i<myOptionList.length;i++)
  5. {
  6. if(myOptionList.options[i].value == optValue);
  7. {
  8. theposition = myOptionList.options[i].index;
  9. }
  10. }
  11. myOptionList.remove(theposition);

Report this snippet  

You need to login to post a comment.