我正在尝试使可选列表像选择框一样,因此当您单击 li
a 时,更改所选 li
a 的标签.
首先,这可能吗? 这是代码:http://jsfiddle.net/dcalixto/h8esW/10/
感谢任何提示:)
最佳答案
绝对有可能使用 text()方法。
$(".genero-box li").click(function() {
$genero = $('.genero'); /* Get the <label> */
$genero.text($(this).text()); /* Set <label>'s text to clicked <li>'s text */
$genero.click(); /* Trigger a click on the label to close the selection */
});
这是 an update到你的代码。
关于javascript - 带有 jquery 的替代选择框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7623874/