これはselectを使用したドロップダウンで、IDはbeh_typeです
<select class="form-control" id="beh_type">
<option value="0">Auto</option>
<option value="1">Man</option>
</select>
これは私の複数選択リストで、IDはmult_typeです
<select multiple="multiple" class="form-control" id="mult_type">
<option value="0">Auto</option>
<option value="1">Man</option>
</select>
これは、if条件を使用したシングルクリックのJavaScriptコードと、beh_typeではなくmult_typeに対して実行されるコードです
if($("select").attr("id") == "mult_type"){
$("select").mousedown(function(e){
e.preventDefault();
var select = this;
var scroll = select.scrollTop;
e.target.selected = !e.target.selected;
setTimeout(function(){select.scrollTop = scroll;}, 0);
$(select).focus();}
}).mousemove(function(e){e.preventDefault()});