Link doesn't work inside UI Selectable

吃可爱长大的小学妹 提交于 2020-01-02 02:01:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!