jQuery remove options from select

后端 未结 8 919
一生所求
一生所求 2020-11-28 02:58

I have a page with 5 selects that all have a class name \'ct\'. I need to remove the option with a value of \'X\' from each select while running an onclick event. My code is

8条回答
  •  粉色の甜心
    2020-11-28 03:39

    if your dropdown is in a table and you do not have id for it then you can use the following jquery:

    var select_object = purchasing_table.rows[row_index].cells[cell_index].childNodes[1];
    $(select_object).find('option[value='+site_name+']').remove();
    

提交回复
热议问题