删除选项的文本而不是禁用它们 - select2 v4

Strike out the text for the options instead of disabling them - select2 v4

我正在尝试显示选项的 strikeout text 而不是禁用它们,因此应该有可能再次 select 它们。 我尝试添加 css 如下所示:

 $(this).css('text-decoration','line-through');
 $(this).css('background','#ccc');

但是其中 none 不起作用,甚至尝试在选项中添加一些 class,使它们的样式为 text-decoration

这是代码片段

$('.employee-dropdown').select2();
$(".employee-dropdown").on('change', function(e) {
  $('.employee-dropdown').each(function(idx, ele) {
    // remove disable attribute.....
    $(ele).find('option').each(function(idx, ele) {
      $(this).removeProp('disabled');
      var optData = $(this).data().data;
      if (optData != undefined) {
        optData.disabled = false;
        optData.element.disabled = false;
      }
    });
    // get selected values, not for current...
    var currSelOptionType = $('.employee-dropdown').not($(ele)).find(':selected').map(function(idx, ele) {
      if ($(ele).data('type') != 0) {
        return $(ele).data('type');
      }
    }).get();
    // ...and for each not selected option.... disable....
    $(this).find('option:not(:selected)').filter(function(idx, ele) {
      if (currSelOptionType.indexOf($(ele).data('type')) != -1) {
        return currSelOptionType.indexOf($(ele).data('type')) != -1;
      }
    }).each(function(idx, ele) {
    
     //add css for the selected otpions
      $(this).css('text-decoration','line-through');
      $(this).css('background','#ccc');
     $(this).prop('disabled', true);
      var optData = $(this).data().data;
      if (optData != undefined) {
        optData.disabled = true;
        optData.element.disabled = true;
      }
    });
    $(this).trigger('change.select2');
  });
}).first().trigger('change');
.select2-container--default .select2-results__option[aria-disabled=true] {
  text-decoration: line-through;
  color: lightcoral !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><link href="https://rawgit.com/select2/select2/master/dist/css/select2.min.css" rel="stylesheet"/>
<script src="https://rawgit.com/select2/select2/master/dist/js/select2.js"></script>

<select name="" class="form-control employee-dropdown">
 <option data-type="0" value="">--Select --</option>
 <option data-type="employee138" value="138" selected="selected">Edwin Warmer </option>
 <option data-type="employee108" value="108">Andrew Hopper </option>
 <option data-type="employee109" value="109">Andrew Moores </option>
 <option data-type="employee112" value="98">Anthony Haldron </option>
 <option data-type="employee116" value="116">Ben Turner </option>
 <option data-type="employee120" value="120">Chris Gough </option>
 <option data-type="employee130" value="130">David Johnson </option>
 <option data-type="employee133" value="133">David Waterfield </option>
 <option data-type="employee143" value="143">Gary Ward </option>
 <option data-type="employee145" value="145">Gavin Taylor </option>
 <option data-type="employee161" value="161">John Arrowsmith </option>
 <option data-type="employee171" value="171">Keith Arrowsmith </option>
 <option data-type="employee176" value="176">Kevin Rose </option>
 <option data-type="employee177" value="177">Kevin Taylor </option>
 <option data-type="employee178" value="178">Kevin Wilcox </option>
 <option data-type="employee189" value="189">Michael Cook </option>
 <option data-type="employee195" value="195">Oliver Franklin </option>
 <option data-type="employee203" value="203">Phillip Westwood </option>
 <option data-type="employee197" value="197">Paul Davis </option>
 <option data-type="employee222" value="222">William Brophy </option>
 <option data-type="employee219" value="219">Stuart Smith </option>
 <option data-type="employee205" value="205">Rob Shorters </option>
 <option data-type="employee204" value="204">Richard Turner </option>
 <option data-type="employee224" value="224">Nathan Barlow </option>
 <option data-type="employee167" value="167">Joseph Bates </option>
 <option data-type="employee227" value="227">Simon Wood </option>
 <option data-type="employee147" value="147">Geoff Hall </option>
 <option data-type="employee140" value="140">Gary Dudley </option>
 <option data-type="employee142" value="142">Gary Parkes </option>
 <option data-type="employee141" value="141">Gary Farmer </option>
 <option data-type="employee123" value="123">Christopher Yarranton </option>
 <option data-type="employee146" value="146">Gavin Williams </option>
 <option data-type="employee148" value="148">George Woodhoods </option>
 <option data-type="employee152" value="152">Ian Attwood </option>
 <option data-type="employee160" value="160">Jason Mills </option>
 <option data-type="employee166" value="166">John Turner </option>
 <option data-type="employee174" value="174">Kevin Jones </option>
 <option data-type="employee181" value="181">Lee Hampson </option>
 <option data-type="employee190" value="190">Michael Turner </option>
 <option data-type="employee193" value="193">Neil Jones </option>
 <option data-type="employee194" value="194">Nick Webb </option>
 <option data-type="employee202" value="202">Phil Clayton </option>
 <option data-type="employee217" value="217">Stewart Jones </option>
 <option data-type="employee215" value="215">Stephen Jarvis </option>
 <option data-type="employee210" value="210">Shaun Smith </option>
 <option data-type="employee207" value="207">Robert Jeapes </option>
 <option data-type="employee158" value="158">Jason Bowen </option>
 <option data-type="employee114" value="114">Barry Arrowsmith </option>
</select>
<p>&nbsp;</p>
<select name="" class="form-control employee-dropdown">
 <option data-type="0" value="">--Select --</option>
 <option data-type="employee108" value="108">Andrew Hopper </option>
 <option data-type="employee112" value="112">Anthony Haldron </option>
 <option data-type="employee120" value="120" selected="selected">Chris Gough </option>
 <option data-type="employee139" value="139">Gary Baggott </option>
 <option data-type="employee141" value="141">Gary Farmer </option>
 <option data-type="employee145" value="145">Gavin Taylor </option>
 <option data-type="employee152" value="152">Ian Attwood </option>
 <option data-type="employee154" value="154">Ivan McGarry </option>
 <option data-type="employee159" value="159">Jason Law </option>
 <option data-type="employee162" value="162">John Bowen </option>
 <option data-type="employee176" value="176">Kevin Rose </option>
 <option data-type="employee178" value="178">Kevin Wilcox </option>
 <option data-type="employee185" value="185">Mark Hall </option>
 <option data-type="employee189" value="189">Michael Cook </option>
 <option data-type="employee190" value="190">Michael Turner </option>
 <option data-type="employee203" value="203">Phillip Westwood </option>
 <option data-type="employee197" value="197">Paul Davis </option>
 <option data-type="employee219" value="219">Stuart Smith </option>
 <option data-type="employee217" value="217">Stewart Jones </option>
 <option data-type="employee216" value="216">Steven Lindsay </option>
 <option data-type="employee208" value="208">Scott Curtis </option>
 <option data-type="employee207" value="207">Robert Jeapes </option>
 <option data-type="employee158" value="158">Jason Bowen </option>
 <option data-type="employee224" value="224">Nathan Barlow </option>
 <option data-type="employee225" value="225">Mat Davis </option>
 <option data-type="employee226" value="226">Wesley Middleton </option>
 <option data-type="employee228" value="228">Connor Demachawski </option>
 <option data-type="employee230" value="230">Nathan Mercy </option>
 <option data-type="employee147" value="147">Geoff Hall </option>
 <option data-type="employee114" value="114">Barry Arrowsmith </option>
 <option data-type="employee214" value="214">Stephen Evans </option>
 <option data-type="employee138" value="138">Edwin Warmer </option>
 <option data-type="employee116" value="116">Ben Turner </option>
 <option data-type="employee130" value="130">David Johnson </option>
 <option data-type="employee133" value="133">David Waterfield </option>
 <option data-type="employee140" value="140">Gary Dudley </option>
 <option data-type="employee142" value="142">Gary Parkes </option>
 <option data-type="employee123" value="123">Christopher Yarranton </option>
 <option data-type="employee146" value="146">Gavin Williams </option>
 <option data-type="employee148" value="148">George Woodhoods </option>
 <option data-type="employee160" value="160">Jason Mills </option>
 <option data-type="employee161" value="161">John Arrowsmith </option>
 <option data-type="employee166" value="166">John Turner </option>
 <option data-type="employee174" value="174">Kevin Jones </option>
 <option data-type="employee177" value="177">Kevin Taylor </option>
 <option data-type="employee181" value="181">Lee Hampson </option>
 <option data-type="employee193" value="193">Neil Jones </option>
 <option data-type="employee194" value="194">Nick Webb </option>
 <option data-type="employee202" value="202">Phil Clayton </option>
 <option data-type="employee222" value="222">William Brophy </option>
 <option data-type="employee215" value="215">Stephen Jarvis </option>
 <option data-type="employee210" value="210">Shaun Smith </option>
 <option data-type="employee167" value="167">Joseph Bates </option>
</select>
<p>&nbsp;</p>
<select name="" class="form-control employee-dropdown">
 <option data-type="0" value="">--Select --</option>
 <option data-type="employee179" value="179">Kyle Halford </option>
 <option data-type="employee138" value="138">Edwin Warmer </option>
 <option data-type="employee108" value="108">Andrew Hopper </option>
 <option data-type="employee109" value="109">Andrew Moores </option>
 <option data-type="employee110" value="110">Andrew Taylor </option>
 <option data-type="employee112" value="112">Anthony Haldron </option>
 <option data-type="employee115" value="115">Ben Downing </option>
 <option data-type="employee116" value="116">Ben Turner </option>
 <option data-type="employee118" value="118">Carl Cox </option>
 <option data-type="employee120" value="120">Chris Gough </option>
 <option data-type="employee126" value="126">Daniel Eastwood </option>
 <option data-type="employee129" value="129">David Hamblett </option>
 <option data-type="employee130" value="130">David Johnson </option>
 <option data-type="employee131" value="131">David Mallin </option>
 <option data-type="employee133" value="133">David Waterfield </option>
 <option data-type="employee139" value="139">Gary Baggott </option>
 <option data-type="employee140" value="140">Gary Dudley </option>
 <option data-type="employee142" value="142">Gary Parkes </option>
 <option data-type="employee143" value="143">Gary Ward </option>
 <option data-type="employee141" value="141">Gary Farmer </option>
 <option data-type="employee123" value="123">Christopher Yarranton </option>
 <option data-type="employee145" value="145">Gavin Taylor </option>
 <option data-type="employee146" value="146">Gavin Williams </option>
 <option data-type="employee148" value="148">George Woodhoods </option>
 <option data-type="employee152" value="152">Ian Attwood </option>
 <option data-type="employee154" value="154">Ivan McGarry </option>
 <option data-type="employee160" value="160">Jason Mills </option>
 <option data-type="employee161" value="161">John Arrowsmith </option>
 <option data-type="employee162" value="162">John Bowen </option>
 <option data-type="employee166" value="166">John Turner </option>
 <option data-type="employee168" value="168">Joshua Turner </option>
 <option data-type="employee171" value="171">Keith Arrowsmith </option>
 <option data-type="employee174" value="174">Kevin Jones </option>
 <option data-type="employee176" value="176">Kevin Rose </option>
 <option data-type="employee177" value="177">Kevin Taylor </option>
 <option data-type="employee178" value="178">Kevin Wilcox </option>
 <option data-type="employee181" value="181">Lee Hampson </option>
 <option data-type="employee185" value="185">Mark Hall </option>
 <option data-type="employee189" value="189">Michael Cook </option>
 <option data-type="employee190" value="190">Michael Turner </option>
 <option data-type="employee193" value="193">Neil Jones </option>
 <option data-type="employee194" value="194">Nick Webb </option>
 <option data-type="employee195" value="195">Oliver Franklin </option>
 <option data-type="employee203" value="203">Phillip Westwood </option>
 <option data-type="employee202" value="202">Phil Clayton </option>
 <option data-type="employee197" value="197">Paul Davis </option>
 <option data-type="employee222" value="222">William Brophy </option>
 <option data-type="employee220" value="220">Tom Downing </option>
 <option data-type="employee219" value="219">Stuart Smith </option>
 <option data-type="employee217" value="217">Stewart Jones </option>
 <option data-type="employee216" value="216">Steven Lindsay </option>
 <option data-type="employee215" value="215">Stephen Jarvis </option>
 <option data-type="employee211" value="211">Simon McGarry </option>
 <option data-type="employee210" value="210">Shaun Smith </option>
 <option data-type="employee208" value="208">Scott Curtis </option>
 <option data-type="employee207" value="207">Robert Jeapes </option>
 <option data-type="employee205" value="205">Rob Shorters </option>
 <option data-type="employee204" value="204">Richard Turner </option>
 <option data-type="employee158" value="158">Jason Bowen </option>
 <option data-type="employee224" value="224">Nathan Barlow </option>
 <option data-type="employee225" value="225">Mat Davis </option>
 <option data-type="employee226" value="226">Wesley Middleton </option>
 <option data-type="employee167" value="167">Joseph Bates </option>
 <option data-type="employee172" value="172">Joseph Bache </option>
 <option data-type="employee227" value="227">Simon Wood </option>
 <option data-type="employee229" value="229">Alan Taylor </option>
 <option data-type="employee230" value="230">Nathan Mercy </option>
 <option data-type="employee147" value="147">Geoff Hall </option>
 <option data-type="employee231" value="231">Jimmy Robinson </option>
 <option data-type="employee163" value="163">John Leitch </option>
 <option data-type="employee124" value="124">Clive Jones </option>
 <option data-type="employee113" value="113">Arron Kwiatek </option>
 <option data-type="employee114" value="114">Barry Arrowsmith </option>
 <option data-type="employee164" value="164">John Mucklow </option>
 <option data-type="employee232" value="232">Scott Westwood </option>
 <option data-type="employee237" value="237">Steve Probert </option>
 <option data-type="employee238" value="238">Daniel Benjamin </option>
 <option data-type="employee214" value="214">Stephen Evans </option>
</select>
<p>
  &nbsp;
</p>
<select name="" class="form-control employee-dropdown">
 <option data-type="0" value="">--Select --</option>
 <option data-type="vanAssetType97" value="97">WM65 ZLY (Pickup)</option>
 <option data-type="vanAssetType98" value="98">WM65 ZLZ (Pickup)</option>
 <option data-type="vanAssetType99" value="99">BV15 ZGB (Pickup)</option>
 <option data-type="vanAssetType100" value="100">BV15 ZFX (Pickup)</option>
 <option data-type="vanAssetType101" value="101">BV15 ZFY (Pickup)</option>
 <option data-type="vanAssetType102" value="102">BV15 ZGA (Pickup)</option>
 <option data-type="vanAssetType103" value="103">BV15 ZFZ (Pickup)</option>
 <option data-type="vanAssetType104" value="104">EX67 WVF (Pickup)</option>
 <option data-type="vanAssetType105" value="105">EX67 WRT (Pickup)</option>
 <option data-type="vanAssetType106" value="106">BV15 ZPH (Crewbus)</option>
 <option data-type="vanAssetType107" value="107">BV15 ZPF (Crewbus)</option>
 <option data-type="vanAssetType108" value="108">BV15 ZPG (Crewbus)</option>
 <option data-type="vanAssetType109" value="109">BV15 ZPJ (Crewbus)</option>
 <option data-type="vanAssetType110" value="110">BV15 ZPK (Crewbus)</option>
 <option data-type="vanAssetType111" value="111">EN17 NDJ (Crewbus)</option>
 <option data-type="vanAssetType133" value="133">YT57 WXJ (Welfare Van)</option>
 <option data-type="vanAssetType134" value="134">YS08 LPU (Welfare Van)</option>
 <option data-type="vanAssetType135" value="135">MA61 FEF (Small Van)</option>
 <option data-type="vanAssetType136" value="136">MW61 BDF (Small Van)</option>
 <option data-type="vanAssetType137" value="137">WT15 AEW (Small Van)</option>
 <option data-type="vanAssetType138" value="138">WT15 AEU (Small Van)</option>
 <option data-type="vanAssetType139" value="139">WT15 AEV (Small Van)</option>
 <option data-type="vanAssetType140" value="140">WT15 AEO (Small Van)</option>
 <option data-type="vanAssetType141" value="141">WT15 AEP (Small Van)</option>
 <option data-type="vanAssetType142" value="142">WR65 SVV (Small Van)</option>
 <option data-type="vanAssetType143" value="143">WT15 AEX (Small Van)</option>
 <option data-type="vanAssetType144" value="144">WR65 JTX (Small Van)</option>
 <option data-type="vanAssetType145" value="145">BU13 WLN (Small Van)</option>
 <option data-type="vanAssetType146" value="146">BK13 WFA (Small Van)</option>
 <option data-type="vanAssetType147" value="147">EX67 WPN (Planer Van)</option>
 <option data-type="vanAssetType148" value="148">YF10 DZD (Planer Van)</option>
 <option data-type="vanAssetType149" value="149">YA10 CLO (Planer Van)</option>
 <option data-type="vanAssetType150" value="150">WU16 ZXR (Planer Van)</option>
 <option data-type="vanAssetType151" value="151">WM65 ZST (Planer Van)</option>
 <option data-type="vanAssetType152" value="152">YC11 OUJ (Planer Van)</option>
 <option data-type="vanAssetType153" value="153">WM65 ZLX (Planer Van)</option>
 <option data-type="vanAssetType154" value="154">WU16 ZXP (Planer Van)</option>
 <option data-type="vanAssetType155" value="155">EX67 WRN (Planer Van)</option>
 <option data-type="vanAssetType167" value="167">Plant Trailer (Plant Trailer)</option>
 <option data-type="vanAssetType168" value="168">EN67 TCU (Small Van)</option>
 <option data-type="vanAssetType169" value="169">EN67 TCX (Small Van)</option>
 <option data-type="vanAssetType170" value="170">EN67 TCV (Small Van)</option>
 <option data-type="vanAssetType171" value="171">MC04 SON (Small Van)</option>
 <option data-type="vanAssetType172" value="172">BD15 ZGY (Small Van)</option>
 <option data-type="vanAssetType173" value="173">BL13 OYJ (Small Van)</option>
 <option data-type="vanAssetType174" value="174">F8 MAC (Small Van)</option>
 <option data-type="vanAssetType175" value="175">WM66 KTK (Fitter's Van)</option>
 <option data-type="vanAssetType176" value="176">YB11 VWG (Fitter's Van)</option>
 <option data-type="vanAssetType177" value="177">YH60 EKK (Fitter's Van)</option>
 <option data-type="vanAssetType178" value="178">PK60 EZN (Fitter's Van)</option>
</select>
<p>
  &nbsp;</p>
<select name="" class="form-control employee-dropdown">
 <option data-type="0" value="">--Select --</option>
 <option data-type="vanAssetType97" value="97" selected="selected">WM65 ZLY (Pickup)</option>
 <option data-type="vanAssetType98" value="98">WM65 ZLZ (Pickup)</option>
 <option data-type="vanAssetType99" value="99">BV15 ZGB (Pickup)</option>
 <option data-type="vanAssetType100" value="100">BV15 ZFX (Pickup)</option>
 <option data-type="vanAssetType101" value="101">BV15 ZFY (Pickup)</option>
 <option data-type="vanAssetType102" value="102">BV15 ZGA (Pickup)</option>
 <option data-type="vanAssetType103" value="103">BV15 ZFZ (Pickup)</option>
 <option data-type="vanAssetType104" value="104">EX67 WVF (Pickup)</option>
 <option data-type="vanAssetType105" value="105">EX67 WRT (Pickup)</option>
 <option data-type="vanAssetType106" value="106">BV15 ZPH (Crewbus)</option>
 <option data-type="vanAssetType107" value="107">BV15 ZPF (Crewbus)</option>
 <option data-type="vanAssetType108" value="108">BV15 ZPG (Crewbus)</option>
 <option data-type="vanAssetType109" value="109">BV15 ZPJ (Crewbus)</option>
 <option data-type="vanAssetType110" value="110">BV15 ZPK (Crewbus)</option>
 <option data-type="vanAssetType111" value="111">EN17 NDJ (Crewbus)</option>
 <option data-type="vanAssetType133" value="133">YT57 WXJ (Welfare Van)</option>
 <option data-type="vanAssetType134" value="134">YS08 LPU (Welfare Van)</option>
 <option data-type="vanAssetType135" value="135">MA61 FEF (Small Van)</option>
 <option data-type="vanAssetType136" value="136">MW61 BDF (Small Van)</option>
 <option data-type="vanAssetType137" value="137">WT15 AEW (Small Van)</option>
 <option data-type="vanAssetType138" value="138">WT15 AEU (Small Van)</option>
 <option data-type="vanAssetType139" value="139">WT15 AEV (Small Van)</option>
 <option data-type="vanAssetType140" value="140">WT15 AEO (Small Van)</option>
 <option data-type="vanAssetType141" value="141">WT15 AEP (Small Van)</option>
 <option data-type="vanAssetType142" value="142">WR65 SVV (Small Van)</option>
 <option data-type="vanAssetType143" value="143">WT15 AEX (Small Van)</option>
 <option data-type="vanAssetType144" value="144">WR65 JTX (Small Van)</option>
 <option data-type="vanAssetType145" value="145">BU13 WLN (Small Van)</option>
 <option data-type="vanAssetType146" value="146">BK13 WFA (Small Van)</option>
 <option data-type="vanAssetType147" value="147">EX67 WPN (Planer Van)</option>
 <option data-type="vanAssetType148" value="148">YF10 DZD (Planer Van)</option>
 <option data-type="vanAssetType149" value="149">YA10 CLO (Planer Van)</option>
 <option data-type="vanAssetType150" value="150">WU16 ZXR (Planer Van)</option>
 <option data-type="vanAssetType151" value="151">WM65 ZST (Planer Van)</option>
 <option data-type="vanAssetType152" value="152">YC11 OUJ (Planer Van)</option>
 <option data-type="vanAssetType153" value="153">WM65 ZLX (Planer Van)</option>
 <option data-type="vanAssetType154" value="154">WU16 ZXP (Planer Van)</option>
 <option data-type="vanAssetType155" value="155">EX67 WRN (Planer Van)</option>
 <option data-type="vanAssetType167" value="167">Plant Trailer (Plant Trailer)</option>
 <option data-type="vanAssetType168" value="168">EN67 TCU (Small Van)</option>
 <option data-type="vanAssetType169" value="169">EN67 TCX (Small Van)</option>
 <option data-type="vanAssetType170" value="170">EN67 TCV (Small Van)</option>
 <option data-type="vanAssetType171" value="171">MC04 SON (Small Van)</option>
 <option data-type="vanAssetType172" value="172">BD15 ZGY (Small Van)</option>
 <option data-type="vanAssetType173" value="173">BL13 OYJ (Small Van)</option>
 <option data-type="vanAssetType174" value="174">F8 MAC (Small Van)</option>
 <option data-type="vanAssetType175" value="175">WM66 KTK (Fitter's Van)</option>
 <option data-type="vanAssetType176" value="176">YB11 VWG (Fitter's Van)</option>
 <option data-type="vanAssetType177" value="177">YH60 EKK (Fitter's Van)</option>
 <option data-type="vanAssetType178" value="178">PK60 EZN (Fitter's Van)</option>
</select>

js fiddle demo here

请提出任何建议。

为了显示选项的删除线文本而不是禁用它们,您可以使用:

templateResult: Customizes the way that search results are rendered.

$('.employee-dropdown').select2({
    templateResult: function (data, container) {
        // add likeDisabledStyle class to current displayed option....
        if (data.element && data.element.classList.contains('likeDisabledStyle')) {
            container.classList.add('likeDisabledStyle');
        }
        return data.text;
    }
});

这样你可以为涉及的元素添加一个你定义的cssclass。

$('.employee-dropdown').select2({
    templateResult: function (data, container) {
        // add likeDisabledStyle class to current displayed option....
        if (data.element && data.element.classList.contains('likeDisabledStyle')) {
            container.classList.add('likeDisabledStyle');
        }
        return data.text;
    }
});

$(".employee-dropdown").on('change', function (e) {
    $('.employee-dropdown').each(function(idx, ele) {
        // remove likeDisabledStyle class .....
        $(ele).find('option.likeDisabledStyle').removeClass('likeDisabledStyle');
        // get selected values, not for current...
        var currSelOptionType = $('.employee-dropdown').not($(ele)).find(':selected').map(function (idx, ele) {
            if ($(ele).data('type') != 0) {
                return $(ele).data('type');
            }
        }).get();
        // ...and for each not selected option.... add likeDisabledStyle class....
        $(this).find('option:not(:selected)').filter(function (idx, ele) {
            if (currSelOptionType.indexOf($(ele).data('type')) != -1) {
                return currSelOptionType.indexOf($(ele).data('type')) != -1;
            }
        }).each(function(idx, ele) {
            $(ele).addClass('likeDisabledStyle');
        });
    });
}).first().trigger('change');
.likeDisabledStyle {
  text-decoration: line-through;
  color: lightcoral !important;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="https://rawgit.com/select2/select2/master/dist/css/select2.min.css" rel="stylesheet"/>
<script src="https://rawgit.com/select2/select2/master/dist/js/select2.js"></script>


<select name="" class="form-control employee-dropdown">
    <option data-type="0" value="">--Select --</option>
    <option data-type="employee138" value="138" selected="selected">Edwin Warmer</option>
    <option data-type="employee108" value="108">Andrew Hopper</option>
    <option data-type="employee109" value="109">Andrew Moores</option>
    <option data-type="employee112" value="98">Anthony Haldron</option>
    <option data-type="employee116" value="116">Ben Turner</option>
    <option data-type="employee120" value="120">Chris Gough</option>
    <option data-type="employee130" value="130">David Johnson</option>
    <option data-type="employee133" value="133">David Waterfield</option>
    <option data-type="employee143" value="143">Gary Ward</option>
    <option data-type="employee145" value="145">Gavin Taylor</option>
    <option data-type="employee161" value="161">John Arrowsmith</option>
    <option data-type="employee171" value="171">Keith Arrowsmith</option>
    <option data-type="employee176" value="176">Kevin Rose</option>
    <option data-type="employee177" value="177">Kevin Taylor</option>
    <option data-type="employee178" value="178">Kevin Wilcox</option>
    <option data-type="employee189" value="189">Michael Cook</option>
    <option data-type="employee195" value="195">Oliver Franklin</option>
    <option data-type="employee203" value="203">Phillip Westwood</option>
    <option data-type="employee197" value="197">Paul Davis</option>
    <option data-type="employee222" value="222">William Brophy</option>
    <option data-type="employee219" value="219">Stuart Smith</option>
    <option data-type="employee205" value="205">Rob Shorters</option>
    <option data-type="employee204" value="204">Richard Turner</option>
    <option data-type="employee224" value="224">Nathan Barlow</option>
    <option data-type="employee167" value="167">Joseph Bates</option>
    <option data-type="employee227" value="227">Simon Wood</option>
    <option data-type="employee147" value="147">Geoff Hall</option>
    <option data-type="employee140" value="140">Gary Dudley</option>
    <option data-type="employee142" value="142">Gary Parkes</option>
    <option data-type="employee141" value="141">Gary Farmer</option>
    <option data-type="employee123" value="123">Christopher Yarranton</option>
    <option data-type="employee146" value="146">Gavin Williams</option>
    <option data-type="employee148" value="148">George Woodhoods</option>
    <option data-type="employee152" value="152">Ian Attwood</option>
    <option data-type="employee160" value="160">Jason Mills</option>
    <option data-type="employee166" value="166">John Turner</option>
    <option data-type="employee174" value="174">Kevin Jones</option>
    <option data-type="employee181" value="181">Lee Hampson</option>
    <option data-type="employee190" value="190">Michael Turner</option>
    <option data-type="employee193" value="193">Neil Jones</option>
    <option data-type="employee194" value="194">Nick Webb</option>
    <option data-type="employee202" value="202">Phil Clayton</option>
    <option data-type="employee217" value="217">Stewart Jones</option>
    <option data-type="employee215" value="215">Stephen Jarvis</option>
    <option data-type="employee210" value="210">Shaun Smith</option>
    <option data-type="employee207" value="207">Robert Jeapes</option>
    <option data-type="employee158" value="158">Jason Bowen</option>
    <option data-type="employee114" value="114">Barry Arrowsmith</option>
</select>

<p>&nbsp;</p>
<select name="" class="form-control employee-dropdown">
    <option data-type="0" value="">--Select --</option>
    <option data-type="employee108" value="108">Andrew Hopper</option>
    <option data-type="employee112" value="112">Anthony Haldron</option>
    <option data-type="employee120" value="120" selected="selected">Chris Gough</option>
    <option data-type="employee139" value="139">Gary Baggott</option>
    <option data-type="employee141" value="141">Gary Farmer</option>
    <option data-type="employee145" value="145">Gavin Taylor</option>
    <option data-type="employee152" value="152">Ian Attwood</option>
    <option data-type="employee154" value="154">Ivan McGarry</option>
    <option data-type="employee159" value="159">Jason Law</option>
    <option data-type="employee162" value="162">John Bowen</option>
    <option data-type="employee176" value="176">Kevin Rose</option>
    <option data-type="employee178" value="178">Kevin Wilcox</option>
    <option data-type="employee185" value="185">Mark Hall</option>
    <option data-type="employee189" value="189">Michael Cook</option>
    <option data-type="employee190" value="190">Michael Turner</option>
    <option data-type="employee203" value="203">Phillip Westwood</option>
    <option data-type="employee197" value="197">Paul Davis</option>
    <option data-type="employee219" value="219">Stuart Smith</option>
    <option data-type="employee217" value="217">Stewart Jones</option>
    <option data-type="employee216" value="216">Steven Lindsay</option>
    <option data-type="employee208" value="208">Scott Curtis</option>
    <option data-type="employee207" value="207">Robert Jeapes</option>
    <option data-type="employee158" value="158">Jason Bowen</option>
    <option data-type="employee224" value="224">Nathan Barlow</option>
    <option data-type="employee225" value="225">Mat Davis</option>
    <option data-type="employee226" value="226">Wesley Middleton</option>
    <option data-type="employee228" value="228">Connor Demachawski</option>
    <option data-type="employee230" value="230">Nathan Mercy</option>
    <option data-type="employee147" value="147">Geoff Hall</option>
    <option data-type="employee114" value="114">Barry Arrowsmith</option>
    <option data-type="employee214" value="214">Stephen Evans</option>
    <option data-type="employee138" value="138">Edwin Warmer</option>
    <option data-type="employee116" value="116">Ben Turner</option>
    <option data-type="employee130" value="130">David Johnson</option>
    <option data-type="employee133" value="133">David Waterfield</option>
    <option data-type="employee140" value="140">Gary Dudley</option>
    <option data-type="employee142" value="142">Gary Parkes</option>
    <option data-type="employee123" value="123">Christopher Yarranton</option>
    <option data-type="employee146" value="146">Gavin Williams</option>
    <option data-type="employee148" value="148">George Woodhoods</option>
    <option data-type="employee160" value="160">Jason Mills</option>
    <option data-type="employee161" value="161">John Arrowsmith</option>
    <option data-type="employee166" value="166">John Turner</option>
    <option data-type="employee174" value="174">Kevin Jones</option>
    <option data-type="employee177" value="177">Kevin Taylor</option>
    <option data-type="employee181" value="181">Lee Hampson</option>
    <option data-type="employee193" value="193">Neil Jones</option>
    <option data-type="employee194" value="194">Nick Webb</option>
    <option data-type="employee202" value="202">Phil Clayton</option>
    <option data-type="employee222" value="222">William Brophy</option>
    <option data-type="employee215" value="215">Stephen Jarvis</option>
    <option data-type="employee210" value="210">Shaun Smith</option>
    <option data-type="employee167" value="167">Joseph Bates</option>
</select>

<p>&nbsp;</p>
<select name="" class="form-control employee-dropdown">
    <option data-type="0" value="">--Select --</option>
    <option data-type="employee179" value="179">Kyle Halford</option>
    <option data-type="employee138" value="138">Edwin Warmer</option>
    <option data-type="employee108" value="108">Andrew Hopper</option>
    <option data-type="employee109" value="109">Andrew Moores</option>
    <option data-type="employee110" value="110">Andrew Taylor</option>
    <option data-type="employee112" value="112">Anthony Haldron</option>
    <option data-type="employee115" value="115">Ben Downing</option>
    <option data-type="employee116" value="116">Ben Turner</option>
    <option data-type="employee118" value="118">Carl Cox</option>
    <option data-type="employee120" value="120">Chris Gough</option>
    <option data-type="employee126" value="126">Daniel Eastwood</option>
    <option data-type="employee129" value="129">David Hamblett</option>
    <option data-type="employee130" value="130">David Johnson</option>
    <option data-type="employee131" value="131">David Mallin</option>
    <option data-type="employee133" value="133">David Waterfield</option>
    <option data-type="employee139" value="139">Gary Baggott</option>
    <option data-type="employee140" value="140">Gary Dudley</option>
    <option data-type="employee142" value="142">Gary Parkes</option>
    <option data-type="employee143" value="143">Gary Ward</option>
    <option data-type="employee141" value="141">Gary Farmer</option>
    <option data-type="employee123" value="123">Christopher Yarranton</option>
    <option data-type="employee145" value="145">Gavin Taylor</option>
    <option data-type="employee146" value="146">Gavin Williams</option>
    <option data-type="employee148" value="148">George Woodhoods</option>
    <option data-type="employee152" value="152">Ian Attwood</option>
    <option data-type="employee154" value="154">Ivan McGarry</option>
    <option data-type="employee160" value="160">Jason Mills</option>
    <option data-type="employee161" value="161">John Arrowsmith</option>
    <option data-type="employee162" value="162">John Bowen</option>
    <option data-type="employee166" value="166">John Turner</option>
    <option data-type="employee168" value="168">Joshua Turner</option>
    <option data-type="employee171" value="171">Keith Arrowsmith</option>
    <option data-type="employee174" value="174">Kevin Jones</option>
    <option data-type="employee176" value="176">Kevin Rose</option>
    <option data-type="employee177" value="177">Kevin Taylor</option>
    <option data-type="employee178" value="178">Kevin Wilcox</option>
    <option data-type="employee181" value="181">Lee Hampson</option>
    <option data-type="employee185" value="185">Mark Hall</option>
    <option data-type="employee189" value="189">Michael Cook</option>
    <option data-type="employee190" value="190">Michael Turner</option>
    <option data-type="employee193" value="193">Neil Jones</option>
    <option data-type="employee194" value="194">Nick Webb</option>
    <option data-type="employee195" value="195">Oliver Franklin</option>
    <option data-type="employee203" value="203">Phillip Westwood</option>
    <option data-type="employee202" value="202">Phil Clayton</option>
    <option data-type="employee197" value="197">Paul Davis</option>
    <option data-type="employee222" value="222">William Brophy</option>
    <option data-type="employee220" value="220">Tom Downing</option>
    <option data-type="employee219" value="219">Stuart Smith</option>
    <option data-type="employee217" value="217">Stewart Jones</option>
    <option data-type="employee216" value="216">Steven Lindsay</option>
    <option data-type="employee215" value="215">Stephen Jarvis</option>
    <option data-type="employee211" value="211">Simon McGarry</option>
    <option data-type="employee210" value="210">Shaun Smith</option>
    <option data-type="employee208" value="208">Scott Curtis</option>
    <option data-type="employee207" value="207">Robert Jeapes</option>
    <option data-type="employee205" value="205">Rob Shorters</option>
    <option data-type="employee204" value="204">Richard Turner</option>
    <option data-type="employee158" value="158">Jason Bowen</option>
    <option data-type="employee224" value="224">Nathan Barlow</option>
    <option data-type="employee225" value="225">Mat Davis</option>
    <option data-type="employee226" value="226">Wesley Middleton</option>
    <option data-type="employee167" value="167">Joseph Bates</option>
    <option data-type="employee172" value="172">Joseph Bache</option>
    <option data-type="employee227" value="227">Simon Wood</option>
    <option data-type="employee229" value="229">Alan Taylor</option>
    <option data-type="employee230" value="230">Nathan Mercy</option>
    <option data-type="employee147" value="147">Geoff Hall</option>
    <option data-type="employee231" value="231">Jimmy Robinson</option>
    <option data-type="employee163" value="163">John Leitch</option>
    <option data-type="employee124" value="124">Clive Jones</option>
    <option data-type="employee113" value="113">Arron Kwiatek</option>
    <option data-type="employee114" value="114">Barry Arrowsmith</option>
    <option data-type="employee164" value="164">John Mucklow</option>
    <option data-type="employee232" value="232">Scott Westwood</option>
    <option data-type="employee237" value="237">Steve Probert</option>
    <option data-type="employee238" value="238">Daniel Benjamin</option>
    <option data-type="employee214" value="214">Stephen Evans</option>
</select>

<p>
    &nbsp;
</p>
<select name="" class="form-control employee-dropdown">
    <option data-type="0" value="">--Select --</option>
    <option data-type="vanAssetType97" value="97">WM65 ZLY (Pickup)</option>
    <option data-type="vanAssetType98" value="98">WM65 ZLZ (Pickup)</option>
    <option data-type="vanAssetType99" value="99">BV15 ZGB (Pickup)</option>
    <option data-type="vanAssetType100" value="100">BV15 ZFX (Pickup)</option>
    <option data-type="vanAssetType101" value="101">BV15 ZFY (Pickup)</option>
    <option data-type="vanAssetType102" value="102">BV15 ZGA (Pickup)</option>
    <option data-type="vanAssetType103" value="103">BV15 ZFZ (Pickup)</option>
    <option data-type="vanAssetType104" value="104">EX67 WVF (Pickup)</option>
    <option data-type="vanAssetType105" value="105">EX67 WRT (Pickup)</option>
    <option data-type="vanAssetType106" value="106">BV15 ZPH (Crewbus)</option>
    <option data-type="vanAssetType107" value="107">BV15 ZPF (Crewbus)</option>
    <option data-type="vanAssetType108" value="108">BV15 ZPG (Crewbus)</option>
    <option data-type="vanAssetType109" value="109">BV15 ZPJ (Crewbus)</option>
    <option data-type="vanAssetType110" value="110">BV15 ZPK (Crewbus)</option>
    <option data-type="vanAssetType111" value="111">EN17 NDJ (Crewbus)</option>
    <option data-type="vanAssetType133" value="133">YT57 WXJ (Welfare Van)</option>
    <option data-type="vanAssetType134" value="134">YS08 LPU (Welfare Van)</option>
    <option data-type="vanAssetType135" value="135">MA61 FEF (Small Van)</option>
    <option data-type="vanAssetType136" value="136">MW61 BDF (Small Van)</option>
    <option data-type="vanAssetType137" value="137">WT15 AEW (Small Van)</option>
    <option data-type="vanAssetType138" value="138">WT15 AEU (Small Van)</option>
    <option data-type="vanAssetType139" value="139">WT15 AEV (Small Van)</option>
    <option data-type="vanAssetType140" value="140">WT15 AEO (Small Van)</option>
    <option data-type="vanAssetType141" value="141">WT15 AEP (Small Van)</option>
    <option data-type="vanAssetType142" value="142">WR65 SVV (Small Van)</option>
    <option data-type="vanAssetType143" value="143">WT15 AEX (Small Van)</option>
    <option data-type="vanAssetType144" value="144">WR65 JTX (Small Van)</option>
    <option data-type="vanAssetType145" value="145">BU13 WLN (Small Van)</option>
    <option data-type="vanAssetType146" value="146">BK13 WFA (Small Van)</option>
    <option data-type="vanAssetType147" value="147">EX67 WPN (Planer Van)</option>
    <option data-type="vanAssetType148" value="148">YF10 DZD (Planer Van)</option>
    <option data-type="vanAssetType149" value="149">YA10 CLO (Planer Van)</option>
    <option data-type="vanAssetType150" value="150">WU16 ZXR (Planer Van)</option>
    <option data-type="vanAssetType151" value="151">WM65 ZST (Planer Van)</option>
    <option data-type="vanAssetType152" value="152">YC11 OUJ (Planer Van)</option>
    <option data-type="vanAssetType153" value="153">WM65 ZLX (Planer Van)</option>
    <option data-type="vanAssetType154" value="154">WU16 ZXP (Planer Van)</option>
    <option data-type="vanAssetType155" value="155">EX67 WRN (Planer Van)</option>
    <option data-type="vanAssetType167" value="167">Plant Trailer (Plant Trailer)</option>
    <option data-type="vanAssetType168" value="168">EN67 TCU (Small Van)</option>
    <option data-type="vanAssetType169" value="169">EN67 TCX (Small Van)</option>
    <option data-type="vanAssetType170" value="170">EN67 TCV (Small Van)</option>
    <option data-type="vanAssetType171" value="171">MC04 SON (Small Van)</option>
    <option data-type="vanAssetType172" value="172">BD15 ZGY (Small Van)</option>
    <option data-type="vanAssetType173" value="173">BL13 OYJ (Small Van)</option>
    <option data-type="vanAssetType174" value="174">F8 MAC (Small Van)</option>
    <option data-type="vanAssetType175" value="175">WM66 KTK (Fitter's Van)</option>
    <option data-type="vanAssetType176" value="176">YB11 VWG (Fitter's Van)</option>
    <option data-type="vanAssetType177" value="177">YH60 EKK (Fitter's Van)</option>
    <option data-type="vanAssetType178" value="178">PK60 EZN (Fitter's Van)</option>
</select>

<p>
    &nbsp;</p>
<select name="" class="form-control employee-dropdown">
    <option data-type="0" value="">--Select --</option>
    <option data-type="vanAssetType97" value="97" selected="selected">WM65 ZLY (Pickup)</option>
    <option data-type="vanAssetType98" value="98">WM65 ZLZ (Pickup)</option>
    <option data-type="vanAssetType99" value="99">BV15 ZGB (Pickup)</option>
    <option data-type="vanAssetType100" value="100">BV15 ZFX (Pickup)</option>
    <option data-type="vanAssetType101" value="101">BV15 ZFY (Pickup)</option>
    <option data-type="vanAssetType102" value="102">BV15 ZGA (Pickup)</option>
    <option data-type="vanAssetType103" value="103">BV15 ZFZ (Pickup)</option>
    <option data-type="vanAssetType104" value="104">EX67 WVF (Pickup)</option>
    <option data-type="vanAssetType105" value="105">EX67 WRT (Pickup)</option>
    <option data-type="vanAssetType106" value="106">BV15 ZPH (Crewbus)</option>
    <option data-type="vanAssetType107" value="107">BV15 ZPF (Crewbus)</option>
    <option data-type="vanAssetType108" value="108">BV15 ZPG (Crewbus)</option>
    <option data-type="vanAssetType109" value="109">BV15 ZPJ (Crewbus)</option>
    <option data-type="vanAssetType110" value="110">BV15 ZPK (Crewbus)</option>
    <option data-type="vanAssetType111" value="111">EN17 NDJ (Crewbus)</option>
    <option data-type="vanAssetType133" value="133">YT57 WXJ (Welfare Van)</option>
    <option data-type="vanAssetType134" value="134">YS08 LPU (Welfare Van)</option>
    <option data-type="vanAssetType135" value="135">MA61 FEF (Small Van)</option>
    <option data-type="vanAssetType136" value="136">MW61 BDF (Small Van)</option>
    <option data-type="vanAssetType137" value="137">WT15 AEW (Small Van)</option>
    <option data-type="vanAssetType138" value="138">WT15 AEU (Small Van)</option>
    <option data-type="vanAssetType139" value="139">WT15 AEV (Small Van)</option>
    <option data-type="vanAssetType140" value="140">WT15 AEO (Small Van)</option>
    <option data-type="vanAssetType141" value="141">WT15 AEP (Small Van)</option>
    <option data-type="vanAssetType142" value="142">WR65 SVV (Small Van)</option>
    <option data-type="vanAssetType143" value="143">WT15 AEX (Small Van)</option>
    <option data-type="vanAssetType144" value="144">WR65 JTX (Small Van)</option>
    <option data-type="vanAssetType145" value="145">BU13 WLN (Small Van)</option>
    <option data-type="vanAssetType146" value="146">BK13 WFA (Small Van)</option>
    <option data-type="vanAssetType147" value="147">EX67 WPN (Planer Van)</option>
    <option data-type="vanAssetType148" value="148">YF10 DZD (Planer Van)</option>
    <option data-type="vanAssetType149" value="149">YA10 CLO (Planer Van)</option>
    <option data-type="vanAssetType150" value="150">WU16 ZXR (Planer Van)</option>
    <option data-type="vanAssetType151" value="151">WM65 ZST (Planer Van)</option>
    <option data-type="vanAssetType152" value="152">YC11 OUJ (Planer Van)</option>
    <option data-type="vanAssetType153" value="153">WM65 ZLX (Planer Van)</option>
    <option data-type="vanAssetType154" value="154">WU16 ZXP (Planer Van)</option>
    <option data-type="vanAssetType155" value="155">EX67 WRN (Planer Van)</option>
    <option data-type="vanAssetType167" value="167">Plant Trailer (Plant Trailer)</option>
    <option data-type="vanAssetType168" value="168">EN67 TCU (Small Van)</option>
    <option data-type="vanAssetType169" value="169">EN67 TCX (Small Van)</option>
    <option data-type="vanAssetType170" value="170">EN67 TCV (Small Van)</option>
    <option data-type="vanAssetType171" value="171">MC04 SON (Small Van)</option>
    <option data-type="vanAssetType172" value="172">BD15 ZGY (Small Van)</option>
    <option data-type="vanAssetType173" value="173">BL13 OYJ (Small Van)</option>
    <option data-type="vanAssetType174" value="174">F8 MAC (Small Van)</option>
    <option data-type="vanAssetType175" value="175">WM66 KTK (Fitter's Van)</option>
    <option data-type="vanAssetType176" value="176">YB11 VWG (Fitter's Van)</option>
    <option data-type="vanAssetType177" value="177">YH60 EKK (Fitter's Van)</option>
    <option data-type="vanAssetType178" value="178">PK60 EZN (Fitter's Van)</option>
</select>