0

如果我单击我的a href按钮,如何使下拉菜单显示?

<a href="#" onclick"makeIDCarsMenuShow()" >my button</a>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected="selected">Fiat</option>
<option value="audi">Audi</option>
</select>


<script>
  function makeIDCarsMenuShow(){
    $('#cars').trigger('click');
  }
</script>
4

1 回答 1

0

尝试这个

 <a href="#" onclick"return makeIDCarsMenuShow()" >my button</a>
 <select name="cars" id="cars">
   <option value="volvo">Volvo</option>
   <option value="saab">Saab</option>
   <option value="fiat" selected="selected">Fiat</option>
   <option value="audi">Audi</option>
 </select>


<script>
   function makeIDCarsMenuShow(){
    $('#cars').click();
    return false;
   }
</script>
于 2012-11-22T10:09:35.070 回答