jQuery:将文本添加到现有选择列表选项值

jQuery:将文本添加到现有选择列表选项值,jquery,append,Jquery,Append,我有一个选择列表: <select class="inputbox" onchange="document.location.replace(this.value);" > <option dir="ltr" value="/nl" >Nederlands (NL)</option> <option dir="ltr" value="/de" >Deutsch (DE)</option> <option d

我有一个选择列表:

<select class="inputbox" onchange="document.location.replace(this.value);" >
    <option dir="ltr" value="/nl" >Nederlands (NL)</option>
    <option dir="ltr" value="/de" >Deutsch (DE)</option>
    <option dir="ltr" value="/en/orange" selected="selected">English (UK)</option>
</select>

荷兰(NL)
德国(德国)
英语(英国)
我需要这个跨度的内容

<dd class="category-name">Category: <span itemprop="genre">Orange</span></dd>
类别:橙色
要添加(包括斜杠)到除所选值以外的所有值。 因此,结果将是:

<select class="inputbox" onchange="document.location.replace(this.value);" >
    <option dir="ltr" value="/nl/orange" >Nederlands (NL)</option>
    <option dir="ltr" value="/de/orange" >Deutsch (DE)</option>
    <option dir="ltr" value="/en/orange" selected="selected">English (UK)</option>
</select>

荷兰(NL)
德国(德国)
英语(英国)
您可以像这样使用.val()

var itemprop=$('.category name span').text().toLowerCase().trim();
$('select.inputbox option:not(:selected)).val(函数(i,文本){
返回文本+'/'+itemprop;
})

类别:橙色
荷兰(NL)
德国(德国)
英语(英国)

您能提供您尝试的代码吗?您想在前两个选项
/nl
/de
中添加“橙色”吗?在另一种情况下,我只想从所选选项(在本例中为“/orange”)中获取“类别”,并附加到其他值(即/nl/orange)。这可能吗?当所选url在拆分后包含更多元素(即“/en/orange/blue”)时,它将仅附加第一个元素(即“/nl/orange”)。如果存在拆分后的所有元素,如何追加?