Link doesn't work inside UI Selectable
Asked Answered
G

1

8

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?

Ghostly answered 2/12, 2010 at 3:7 Comment(0)
H
11

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

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

Look at it working here.

Haye answered 2/12, 2010 at 3:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.