如何在 SelectListActions 中添加复选框

How to add a checkbox in SelectListActions

我需要为复仇者联盟添加复选框,S.H.I.E.L.D,&正义联盟&超级英雄&你已经选择了列表

在下面的演示代码中

jsfiddle.net/nzdak7aL/98

将其添加到 js 中

$('option').mousedown(function(e) {
    e.preventDefault();
    $(this).prop('selected', !$(this).prop('selected'));
    return false;
  });

进入css 选项::

before {
  content: "10";
  width: 1.3em;
  text-align: center;
  display: inline-block;
}
option:checked::before {
  content: "11";
}

试试这个http://jsfiddle.net/nzdak7aL/101/

您的要求不明确。您能否添加更多详细信息?

如果我没理解错的话,您想在多 select 字段中添加复选框吗?这没有任何意义。

如果您需要自定义样式的复选框,只需执行以下操作:

<input id="checkbox-avenger" type="checkbox" name="something" value="Avengers" style="display: none;" />
<label for="checkbox-avenger">**here you custom layout stuff**</label>