How to un-selecte li of UI Selectable via element click event?
I want to unselected selected li by click other element.E.g:
<style>
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script>
$(function() {
$( "#selectable" ).selectable();
});
</script>
<div class="demo">
<ol id="selectable">
<li class="ui-widget-content"><a href="">link can not click</a></li>
<li class="ui-widget-content">Item 2</li>
<li class="ui-widget-content">Item 3</li>
<li class="ui-widget-content">Item 4</li>
<li class="ui-widget-content">Item 5</li>
<li class="ui-widget-content">Item 6</li>
<li class="ui-widget-content">Item 7</li>
</ol>
<a href="">click me to unselected</a>
开发者_开发问答</div><!-- End demo -->
Thank you very much!!
Just removing the class seems to work fine (from my jsfiddle of your previous question):
<a href="#" id="unselect">click me to unselected</a>
and then:
$('#unselect').click(function(event) {
$('#selectable>li').removeClass('ui-selected');
});
精彩评论