まず、私のフィドルを見てください:my FiddlejQuery - 選択とオプションの入力、より良い方法ですか?
もっと簡単な方法はありますか?
私のやり方が正常に動作しますが、私はまだ満足していない:)これについて
javascript
$(document).ready(function(){
$("#input").click(function(){
$("#selectives").css('display', 'block'); // displays block "div #selectives" underneath
$("input").css('borderRadius', '2px 2px 0px 0px'); // not that important.. just css
});
$(".auswahl").click(function(){ // .auswahl (every li element)
var thisWord = $(this).html(); // thisWord = the word u want to get the value of
$("#input").val(thisWord); // puts the value of "thisWord" into the #input
$("#selectives").css('display', 'none'); // immediately if you click an li element, it should disappear
$("input").css('borderRadius', '2px'); // not that important.. just css
});
});
フィードバックをありがとうございました!より多くの変数とクラスを使用しようとします。 – Syno