如何將選擇框selectedIndex重置爲0?它的工作原理與普通selectboxes,但在由bootstrap.js如何將引導選擇框的selectedIndex重置爲0?
發展引導現代selecboxes不工作我的代碼HTML:
<select id="profile_ids" class="input-xlarge" data-rel="chosen">
<option value="0">Select</option>
<option value="1">Test 1</option>
<option value="2">Test 2</option>
</select>
<select id="test_ids" class="input-xlarge" data-rel="chosen">
<option value="0">Select</option>
<option value="1">Test 1</option>
<option value="2">Test 2</option>
</select>
<input type="button" class="btn" name="reset" value="Reset" id="reset" onclick="reset_value()"/>
的Javascript:
function reset_value()
{
$('#reset').click(function(){
$('#profile_ids option[value="0"]').attr('selected','selected');
});
$('#reset').click(function(){
$('#test_ids option[value="0"]').attr('selected','selected');
});
}