Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save FirstVertex/270700ba49f74f0c6091 to your computer and use it in GitHub Desktop.
Save FirstVertex/270700ba49f74f0c6091 to your computer and use it in GitHub Desktop.
Select2 with Primary selected item 1/4
<label for="Troops">Troops</label>
<select name="Troops" id="Troops" multiple="" class="primary-selectable">
<option value="1">Barbarian</option>
<option value="2">Archer</option>
<option value="3">Goblin</option>
<option value="4">Giant</option>
<option value="5" selected="selected">Wall Breaker</option>
<option value="6">Balloon</option>
<option value="7" selected="selected">Wizard</option>
<option value="8">Healer</option>
<option value="9">Dragon</option>
<option value="10" selected="selected">P.E.K.K.A.</option>
<option value="11">Minion</option>
<option value="12">Hogrider</option>
<option value="13">Valkyrie</option>
<option value="14" selected="selected">Golem</option>
<option value="15" selected="selected">Witch</option>
<option value="16">Lava Hound</option>
<option value="17" selected="selected">Barbarian King</option>
<option value="18" selected="selected">Archer Queen</option>
</select>
<label>Primary Troop</label>
<input type="hidden" id="TroopsPrimary" name="TroopsPrimary" value="17">
<span id="TroopsPrimaryDisplay"></span>
<span id="TroopsPrimaryDisplayNone">No Primary Troop selected</span>
@FirstVertex
Copy link
Author

see here for all code

@FirstVertex
Copy link
Author

see here for full explanation on my Blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment