开发者

jQuery UI Selectable with user content inside list item

开发者 https://www.devze.com 2022-12-29 14:34 出处:网络
I have ASP.NET MVC application that has list with jQuery Selectable list. My problem is that selecting items doesn\'t work very well if I have images (or other content) inside. I would like to have wh

I have ASP.NET MVC application that has list with jQuery Selectable list. My problem is that selecting items doesn't work very well if I have images (or other content) inside. I would like to have whole content to be selectable, not just the image. Does someone know how to accomplish that?

To get the 开发者_JAVA百科idea I have attached an image where you can see that some of the items have an icon and others have been pushed to the right with div.

<ol id="productUnits">
<% foreach (ParameterTabViewModel.Unit unit in Model.UnitsViewModel.ProductVersionUnits)
{ %>
    <li class="ui-widget-content"><%= unit.IsUsed ? "<img style=\"float: left; width: 16px; height: 16px; margin-right: 4px; \" src=\"/Content/Images/special.png\"/>" : "<div style=\"float: left; width: 20px; height: 16px;\"></div>"%> <%= unit.Name %><%= Html.Hidden("ProductVersionUnits", unit.Id) %></li>
<% } %>
</ol>

jQuery UI Selectable with user content inside list item

(source: www.tx3.fi)

Thanks


Solution

I had to add a filter like this $("#selectable").selectable({ filter: 'li' });

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号