code not working neither getting any error
I am not getting any error neither the code is working, whats wrong in my code?
- <!DOCTYPE html>
- <html>
- <head>
- <title>Radio button and List Check</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
- <script type="text/javascript" >
- $("#country").change(function() {
- var country = $(this).val()
- var currency = {
- USD: "USD",
- EUR: "EUR",
- GBP: "GBP"
- }[country]
- console.log(country, currency)
- if (currency)
- $("[name=optradio][value='" + currency + "']").prop("checked", true)
- })
- </script>
- </head>
- <body>
- <form class="form-horizontal" action="" method="post">
- <div class="form-group">
- <label class="col-sm-2 control-label" for="devices2">Country</label>
- <div class="col-sm-10">
- <select class="form-control" id="country">
- <option value="">Please select Country</option>
- <option value="USD">US</option>
- <option value="EUR">EU</option>
- <option value="GBP">UK</option>
- <option value="USD">China</option>
- <option value="USD">India</option>
- <option value="USD">Korea</option>
- <option value="USD">Asia</option>
- <option value="USD">Russia</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" for="devices1">Currency</label>
- <div class="col-sm-10">
- <label class="radio-inline">
- <input type="radio" name="optradio" disabled>USD</label>
- <label class="radio-inline">
- <input type="radio" name="optradio" disabled>EUR</label>
- <label class="radio-inline">
- <input type="radio" name="optradio" disabled>GBP</label>
- </div>
- </div>
- </form>
- </body>
- </html>