0
我試圖選擇我認爲這是使用knockoutjs創建選擇一個選項(但我不知道)jQuery的這是用基因敲除
<select class="styled" data-bind="options: Locations, optionsText: 'Name', value: DesiredLocat…ion: SelectLocationText(), event: { change: UpdateLocation }">
<option value="">
Select location
</option>
<option value="">
Some location
</option>
<option value="">
Some location2
</option>
</select>
整個事情是在框架中捆綁的創建選擇選項,我GOOGLE瞭如何使jQuery的工作框架,現在我使用它像這樣
var frameDocument= $("frame[name='mainFrame']", top.document)[0].contentDocument;
我試圖做這樣的:
$(frameDocument).find('.styled').val('Some location').change();
像這樣:
$(frameDocument).find('.styled').children().each(function(){
if ($(this).text()=='Some location'){
$(this).click();
return false;
}
})
任何人都可以請幫我如何選擇我需要的選項?
我應該如何選擇使用基因敲除的選項? – Asiat
的事情是,我不是網站的所有者,我正在爲它寫一個爬蟲,我需要選擇一個選項。在Chrome中,當我在開發者控制檯中輸入'ko'時,它給了我這個對象,但是,在firefox中它沒有。我相信它與框架有關。正如我所說的整個東西是捆綁在一個這樣的框架:'
' – Asiat您需要找出它屬於哪個視圖模型是任何父視圖模型,然後更新敲除可觀察值。例如:'MainVM.SubVM()。selectedLocation(3);' –