|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> |
| 6 | + <link href="../lib/metro.css" rel="stylesheet"> |
| 7 | + <link href="../lib/icons.css" rel="stylesheet"> |
| 8 | + |
| 9 | + <title>Test Select val() - Metro UI :: Popular HTML, CSS and JS library</title> |
| 10 | + |
| 11 | +</head> |
| 12 | +<body class="cloak h-100-vh"> |
| 13 | +<nav data-role="appbar" class="border-bottom bd-default" data-expand="true"> |
| 14 | + <div class="app-bar-item-static no-hover"> |
| 15 | + <div class="text-leader">Select.val()</div> |
| 16 | + </div> |
| 17 | + <div class="app-bar-item-static no-hover ml-auto"> |
| 18 | + <input type="checkbox" data-role="theme-switcher"/> |
| 19 | + </div> |
| 20 | +</nav> |
| 21 | + |
| 22 | +<div class="container h-100 d-flex flex-column flex-center gap-2"> |
| 23 | + <div class="d-flex gap-2"> |
| 24 | + <div style="flex: 0 0 200px;"> |
| 25 | + <select id="sel1" |
| 26 | + data-role="select" |
| 27 | + data-cls-select="text-bold fg-orange" |
| 28 | + data-clear-button="true" |
| 29 | + data-cls-label="text-bold fg-black" size="1"> |
| 30 | + <option value=""> </option> |
| 31 | + <option value="M" |
| 32 | + data-icon="<SPAN class='mif-gamepad mif-2x fg-black'></SPAN>">Machines |
| 33 | + </option> |
| 34 | + <option value="C" |
| 35 | + data-icon="<SPAN class='mif-display mif-2x fg-black'></SPAN>">Computers |
| 36 | + </option> |
| 37 | + </select> |
| 38 | + </div> |
| 39 | + <button onclick="$('#sel1').data('select').val('C')">Set Val</button> |
| 40 | + <button onclick="$('#sel1').data('select').reset()">Reset</button> |
| 41 | + </div> |
| 42 | + <div class="d-flex gap-2"> |
| 43 | + <div style="flex: 0 0 200px;"> |
| 44 | + <select id="sel2" multiple |
| 45 | + data-role="select" |
| 46 | + data-cls-select="text-bold fg-orange" |
| 47 | + data-cls-label="text-bold fg-black" size="1"> |
| 48 | + <option value=""> </option> |
| 49 | + <option value="M" |
| 50 | + data-icon="<SPAN class='mif-gamepad mif-2x fg-black'></SPAN>">Machines |
| 51 | + </option> |
| 52 | + <option value="C" |
| 53 | + data-icon="<SPAN class='mif-display mif-2x fg-black'></SPAN>">Computers |
| 54 | + </option> |
| 55 | + </select> |
| 56 | + </div> |
| 57 | + <button onclick="$('#sel2').data('select').val(['C', 'M'])">Set Val</button> |
| 58 | + <button onclick="$('#sel2').data('select').reset()">Reset</button> |
| 59 | + </div> |
| 60 | + <div class="d-flex gap-2"> |
| 61 | + <div style="flex: 0 0 200px;"> |
| 62 | + <select id="sel3" |
| 63 | + data-role="select" |
| 64 | + > |
| 65 | + <option value=""> </option> |
| 66 | + <option value="M" |
| 67 | + data-template="<SPAN class='fg-red text-bold mr-2'>M</SPAN>$1">Machines |
| 68 | + </option> |
| 69 | + <option value="C" |
| 70 | + data-template="<SPAN class='fg-green text-bold mr-2'>C</SPAN>$1">Computers |
| 71 | + </option> |
| 72 | + </select> |
| 73 | + </div> |
| 74 | + <button onclick="$('#sel3').data('select').val('M')">Set Val</button> |
| 75 | + <button onclick="$('#sel3').data('select').reset()">Reset</button> |
| 76 | + </div> |
| 77 | +</div> |
| 78 | + |
| 79 | +<script src="../lib/metro.js"></script> |
| 80 | +<script> |
| 81 | +</script> |
| 82 | +</body> |
| 83 | +</html> |
0 commit comments