2011-05-05 9 views

답변

2

전달 된 텍스트 값을 기준으로 드롭 다운 색인을 선택한다고 가정합니다.

$("select option[value="+searchText+"]").attr("selected", true); 
1

값이 텍스트 상자에있는 옵션을 선택 하시겠습니까?

$("#select1").val($("#text1").val()); 

희망이 있습니다. 건배

0

값이나 텍스트 별 드롭 다운리스트 항목을 선택,이

//this is to set selected item by value 
$('#dropDownList').val('setToNewValue'); 

//this is to select by text 
var findText = $('#textBoxId').val(); 
$('#dropDownList option'). 
    filter(function() {return ($(this).text() == findText); })). 
    attr('selected', 'selected'); 
를 사용