Untitled
unknown
javascript
2 years ago
1.4 kB
5
Indexable
<!DOCTYPE html> <html> <body> <h2>My Heading</h2> <p>Play around with the code and click on the "Run" button to view the result.</p> <p id="demo"></p> <input class="input__small" type="checkbox" name="policy_check_yes" id="gdprCheckbox" title="Accept our privacy policy and GDPR" value="Yes" required="" onclick="clickz()"> <label for="gdprCheckBox">By subing u accept</label> <select id="select" hidden="true" name="purpose"><option value="all">All Offices</option><option value="Midelfart">Midelfart</option><option value="Copenhagen">Copenhagen</option><option value="Monaco">Monaco</option><option value="Dubai">Dubai</option><option value="Cape Town">Cape Town</option><option value="Singapore">Singapore</option><option value="Beijing">Beijing</option><option value="Sydney">Sydney</option><option value="Houston">Houston</option></select> <script> let x = 5; let y = 6; let z = x + y; document.getElementById("demo").innerHTML = "The value of z is: " + z; function clickz() { let box = document.getElementById("gdprCheckbox").checked; console.log(box) let optset = document.getElementById("select"); if (box) { optset.value = "Copenhagen"; console.log(optset.value) } else { optset.value = "Dubai"; console.log(optset.value) } } </script> </body> </html>
Editor is loading...