0

I have the following fiddle: http://jsfiddle.net/VYbLX/125/

The purpose is to update a thumbnail with the appropriate selection in the dropdown menu. I'm attempting to implement this piece of code inside of a Drupal block that will be dropped into a specific page.

The page it is implemented on is: http://sulzbachercenter.org/fundraisers/give-a-good-night In order to implement the code, I've rewritten the JS into a separate file and called it like this:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://sulzbachercenter.org/sites/default/files/ggn_js/dyn.js"></script>

The block can run PHP and HTML fully, so I know that's not an issue - but I'm out of troubleshooting ideas. Can anyone see why this code won't work in the Drupal environment?

Kazoou
  • 9
  • 3

1 Answers1

0

The jQuery selector is looking for '#dynSelect', but the combobox in the form does not have an 'id'.

You can either add the id="dynSelect" to the combobox.

or
Change

$('#dynSelect').change(function () {
    var val = $('#dynSelect').val();
    $('#dynImg').attr("src",pictureList[val]);
});

to something like:

$("select[name='os0']").change(function () {
    var val = $("select[name='os0']").val();
    $('#dynImg').attr("src",pictureList[val]);
});
2pha
  • 9,798
  • 2
  • 29
  • 43
  • Wow. I totally forgot to put the id on the combobox in the code on the site. And I had been pulling out my hair trying to troubleshoot more obscure problems. Thanks so much for pointing me in the right direction 2pha! – Kazoou Dec 06 '14 at 17:37