Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link doesn't work inside UI Selectable

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?

like image 839
qinHaiXiang Avatar asked Dec 02 '10 03:12

qinHaiXiang


1 Answers

Use cancel (look in the options), like this:

$(function() {
    $("#selectable").selectable({ cancel: 'a' });
});

Look at it working here.

like image 173
cambraca Avatar answered Nov 02 '22 00:11

cambraca