【发布时间】:2016-12-21 12:20:37
【问题描述】:
首先,看看我的小提琴:my Fiddle
有没有更简单的方法?
我的方法很好,但我还不开心:)
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
});
});
【问题讨论】: