私はこのプラグインを使用しています - http://plugins.jquery.com/project/styledSelect私のページの選択ボックスのスタイルを設定しています。ここでのデモページ - 、jQuery.styledSelectプラグイン - dom内の別の要素からselectを開きます
$('#show-lists').styledSelect(); //apply the plugin on page load
$("#another-button").toggle(
function() {
$('#show-lists').clickSelect() //open the dropdown
},
function() {
$('#show-lists').closedSelect() //close it
},
);
上記のコードは動作しません - http://liepins.org/files/jQuery.styledSelect-1.0/examples.html
私は、ページ上の他の要素から選択ボックスを開閉する方法を把握するような何かをしようとしてきました説明するだけの場所です。どのように私はこれらのメソッドに外部からアクセスできますか?あるいは、誰かが代替案を提案することができますか?
ありがとうございます。
これは完璧なおかげで、よく説明されています。とても有難い。 – Finnnn
ここには何がありますか?これは '$( 'select')'ですか? – Manwal
@Manwalはい、効果的です。それは[プラグインのコード](https://code.google.com/p/lnet/source/browse/trunk/jQuery.styledSelect/jQuery.styledSelect.js)です。現在は100行目に加えて、公開するように提案した2行目選択ボックス上の新しいイベントにそれらをバインドすることによって、そのプライベートな機能を実現します。あなたは、プラグインに渡された選択項目の各ループ内で 'var s = jQuery(this);;を定義するのは正しいです。 – Rup