问题
these are the code from JQuery website and I rewrite the contents of one :
<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>
</div><!-- End demo -->
it seems the link inside li
doesn't work any more.So ,How can I re-struct the code to make the li
could be selected and the link still available at the same time?
回答1:
Use cancel (look in the options), like this:
$(function() {
$("#selectable").selectable({ cancel: 'a' });
});
Look at it working here.
来源:https://stackoverflow.com/questions/4331303/link-doesnt-work-inside-ui-selectable