简体   繁体   English

jQuery UI:选择一个项目?

[英]jQuery UI: Make an item selected?

If I have a list and a link, like this: 如果我有一个列表和链接,例如:

<a href="">Select</a>

<ul>
    <li>f</li>
    <li>fd</li>
    <li>fa</li>
    <li>fd</li>
</ul>

<script> $("ul").selectable(); </script>

Is it possible to make an item be selected on any arbitrary event? 是否可以在任意事件中选择一个项目? Something like: 就像是:

$('a').bind('click', function()
{
      $('.ul-selectable').children().first().select('on');
      $('.ul-selectable').children().last().select('off');
});

Why not? 为什么不? Just create a class and on selecting a particular item apply that class to that particular item :) 只需创建一个类,然后在选择特定项目时将该类应用于该特定项目即可:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM