Jquerymobile - problem: Change image on radio button select
Dear all,
im new to jquery and jscript
i would like to change images depending on the selection of a radio button.
i try it like shown below but cant get it working, can you help me ?
Thanks Thomas
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
- <script type="text/javascript">
- $("input.seq").change(function(){
- if ($("input.seq:checked").val() == 1) {
- $('#logo_img').attr('src', 'img1.jpg');
- }
- else {
- $('#logo_img').attr('src', 'img2.jpg');
- }
- });
- </script>
- <div class="logo_img">
- displays image here
- </div>
-
- <fieldset data-role="controlgroup" class="seq">
- <input type="radio" name="seq" id="radio-choice-1" value="1" checked="checked" class="seq" />
- <label for="radio-choice-1">Cat</label>
- <input type="radio" name="seq" id="radio-choice-2" value="2" class="seq" />
- <label for="radio-choice-2">Dog</label>
- <input type="radio" name="seq" id="radio-choice-3" value="3" class="seq" />
- <label for="radio-choice-3">Hamster</label>
- <input type="radio" name="seq" id="radio-choice-4" value="4" class="seq"/>
- <label for="radio-choice-4">Lizard</label>
- </fieldset>